Logo: Relish

  1. Sign up
  2. Sign in

Project: Lombard

LOM8.4 Hard Server Side Validations

User tries to save form
In order to make sure my data is correct
As a user filling out the form
I want the form to check for correct ranges

Scenarios
  • @javascript
  • @wip
Dependencies and validations
Given
I parse
survey "Dependency and validation survey" do
  section "Conditionals" do
    q_montypython3 "What... is your name? (e.g. It is 'Arthur', King of the Britons)"
    a_1 :string
    q_montypython4 "What... is your quest? (e.g. To seek the Holy Grail)"
    a_1 :string
    dependency :rule => "A"
    condition_A :q_montypython3, "==", {:string_value => "It is 'Arthur', King of the Britons", :answer_reference => "1"}
    q "How many pets do you own?"
    a :integer
    validation :rule => "A"
    condition_A ">=", :integer_value => 0
    q "What is your address?", :custom_class => 'address'
    a :text, :custom_class => 'mapper'
    validation :rule => "AC"
    vcondition_AC "=~", :regexp => /[0-9a-zA-z\. #]/

    q_2 "Which colors do you loathe?", :pick => :any
    a_1 "red"
    a_2 "blue"
    a_3 "green"
    a_4 "yellow"

    q_2a "Please explain why you hate so many colors?"
    a_1 "explanation", :text
    dependency :rule => "Z"
    condition_Z :q_2, "count>2"
  end
end
Then
there should be 1 survey with:
title
Dependency and validation survey
And
there should be 6 questions with:
text pick display_type custom_class
What... is your name? (e.g. It is 'Arthur', King of the Britons) none default nil
What is your address? none default address
And
there should be 2 dependency with:
rule
A
Z
And
there should be 2 resolved dependency_condition with:
rule_key
A
Z
And
there should be 2 validations with:
rule
A
AC
And
there should be 2 validation_conditions with:
rule_key integer_value
A 0

Last published over 1 year ago by wminsinger.