Logo: Relish

  1. 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

Background
Given
the survey
  survey "Ranges" do
    section "Section One" do
    label "Float Ranges"

    q_1 "tall are you?", :is_mandatory => true
      answer "height", :float
      validation :rule => "A", :warning => true
      condition_A ">=", :float_value => 24.5

    q_2 "how many fingers do you have?", :is_mandatory => true
      answer "fingers", :float
      validation :rule => "A", :message => "Has more than ten fingers", :warning => true
      condition_A "<=", :float_value => 10.0

    q_3 "what is your weight?", :is_mandatory => true
      answer "weight", :float
      validation :rule => "A and B", :message => "This is an unusual weight", :warning => true
      condition_A "<=", :float_value => 450.5
      condition_B ">=", :float_value => 1.5
    end
  end
Given
I am signed in as a clinician
And
I start the "Ranges" survey
Scenarios
  • @javascript
All float values within ranges
When
I fill in and change "height" with "30.5"
And
I fill in and change "fingers" with "9.5"
And
I fill in and change "weight" with "200.8"
Then
I should not see an inline warning
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 "Responses include warnings"
  • @javascript
All float values out of ranges
When
I fill in and change "height" with "12.2"
Then
I should see an inline warning
And
I fill in and change "fingers" with "14.5"
Then
I should see the inline warning "Has more than ten fingers"
And
I fill in and change "weight" with "500.4"
Then
I should see the inline warning "This is an unusual weight"
And
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 see "Responses include warnings" within the alert flash

Last published over 5 years ago by wminsinger.