To add a collaborator to this project you will need to use the Relish gem to add the collaborator via a terminal command. Soon you'll be able to also add collaborators here!
More about adding a collaboratorLOM8.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
- Background
-
- Given
-
the survey
survey "Ranges" do section "Section One" do label "Integer Ranges" q_1 "how tall are you?", :is_mandatory => true answer "height", :integer validation :rule => "A" condition_A ">=", :integer_value => 24 q_2 "how many fingers do you have?", :is_mandatory => true answer "fingers", :integer validation :rule => "A", :message => 'Cannot have more than ten fingers' condition_A "<=", :integer_value => 10 q_3 "what is your weight?", :is_mandatory => true answer "weight", :integer validation :rule => "A and B", :message => 'Must be in range' condition_A "<=", :integer_value => 500 condition_B ">=", :integer_value => 1 end end
- Given
- I am signed in as a clinician
- And
- I start the "Ranges" survey
- Scenarios
-
- All integer values within ranges
- All integer values out of ranges, putting one field at a time
- All integer values out of ranges, when submitting the form
- Should remove errors when good data is entered
- All integer values within ranges
-
- When
- I fill in and change "height" with "72"
- And
- I fill in and change "fingers" with "10"
- And
- I fill in and change "weight" with "225"
- Then
- I should not see an inline error
- When
- I press "Click here to finish"
- Then
- the survey should now be complete
- And
- I should be on the surveys page
- And
- I should see "Completed survey" within the notice flash
- And
- I should not see "Unable to update survey"
- All integer values out of ranges, putting one field at a time
-
- When
- I fill in and change "height" with "1"
- Then
- I should see an inline error
- When
- I fill in and change "fingers" with "15"
- Then
- I should see the inline error "Cannot have more than ten fingers"
- When
- I fill in and change "weight" with "1000"
- Then
- I should see the inline error "Must be in range"
- When
- I press "Click here to finish"
- Then
- the survey is not complete
- And
- I should be on the "Ranges" survey page
- And
- I should see "Unable to update survey" within the error flash
- Then
- I should see the inline error "Invalid response"
- And
- I should see the inline error "Cannot have more than ten fingers"
- And
- I should see the inline error "Must be in range"
- All integer values out of ranges, when submitting the form
-
- When
- I fill in "height" with "1"
- And
- I fill in "fingers" with "15"
- And
- I fill in "weight" with "1000"
- And
- I press "Click here to finish"
- Then
- the survey is not complete
- And
- I should be on the "Ranges" survey page
- And
- I should see "Unable to update survey" within the error flash
- And
- I should see the inline error "Invalid response"
- And
- I should see the inline error "Cannot have more than ten fingers"
- And
- I should see the inline error "Must be in range"
- Should remove errors when good data is entered
-
- When
- I fill in and change "height" with "1"
- Then
- I should see an inline error
- And
- I fill in and change "height" with "100"
- Then
- I should not see an inline error
Last published almost 7 years ago by wminsinger.