Skip to content

Commit

Permalink
Moved our custom step title validation to our validation scenario out…
Browse files Browse the repository at this point in the history
…line
  • Loading branch information
baphled committed Jul 16, 2010
1 parent 22bf0d4 commit dd9249e
Showing 1 changed file with 34 additions and 54 deletions.
88 changes: 34 additions & 54 deletions features/plain/form_validations.feature
Expand Up @@ -12,62 +12,42 @@ Feature: Validation of forms
And I should see "<error>" within "<selector>"

Examples: Models and their properties
| controller | model | value | property | input_type | selector | error |
| features | feature | | title | input | li#feature_title_input | can't be blank |
| features | feature | to | title | input | li#feature_title_input | Please enter at least 6 characters. |
| features | feature | | in_order | input | li#feature_title_input | can't be blank |
| features | feature | to do | in_order | input | li#feature_in_order_input | Please enter at least 7 characters. |
| features | feature | | as_a | input | li#feature_title_input | can't be blank |
| features | feature | use | as_a | input | li#feature_as_a_input | Please enter at least 4 characters. |
| features | feature | | i_want | input | li#feature_title_input | can't be blank |
| features | feature | not | i_want | input | li#feature_i_want_input | Please enter at least 7 characters. |
| projects | project | | title | input | li#project_title_input | can't be blank |
| projects | project | so | title | input | li#project_title_input | Please enter at least 3 characters. |
| projects | project | | aim | input | li#project_title_input | can't be blank |
| projects | project | foo | aim | input | li#project_aim_input | Please enter at least 6 characters. |
| projects | project | | description | input | li#project_title_input | can't be blank |
| projects | project | too short | description | input | li#project_description_input | Please enter at least 12 characters. |
| projects | project | blah/ | location | input | li#project_location_input | Must be a valid project location on your system. |
| steps | step | | title | input | li#step_title_input | can't be blank |
| steps | step | foo | title | input | li#step_title_input | Please enter at least 12 characters. |
| stories | story | blah | scenario | input | li#story_scenario_input | Please enter at least 7 characters. |
| stories | story | | scenario | input | li#story_scenario_input | can't be blank |
| parking | resource | | name | input | li#resource_name_input | can't be blank |
| parking | resource | | name | input | li#resource_name_input | Please enter at least 3 characters. |
| parking | resource | | project | input | li#resource_project_input | can't be blank |
| parking | resource | | project | input | li#resource_project_input | Please enter at least 3 characters. |


# Relies on fixtures
Scenario: A project must be unique
Given I can view the projects page
When I click new projects
And I fill in the project form with duplicate data
Then submit the form
And the project information should not be saved
And the error message should be "has already been taken"
| controller | model | value | property | input_type | selector | error |
| features | feature | | title | input | li#feature_title_input | can't be blank |
| features | feature | to | title | input | li#feature_title_input | Please enter at least 6 characters. |
| features | feature | | in_order | input | li#feature_title_input | can't be blank |
| features | feature | to do | in_order | input | li#feature_in_order_input | Please enter at least 7 characters. |
| features | feature | | as_a | input | li#feature_title_input | can't be blank |
| features | feature | use | as_a | input | li#feature_as_a_input | Please enter at least 4 characters. |
| features | feature | | i_want | input | li#feature_title_input | can't be blank |
| features | feature | not | i_want | input | li#feature_i_want_input | Please enter at least 7 characters. |
| projects | project | | title | input | li#project_title_input | can't be blank |
| projects | project | so | title | input | li#project_title_input | Please enter at least 3 characters. |
| projects | project | | aim | input | li#project_title_input | can't be blank |
| projects | project | foo | aim | input | li#project_aim_input | Please enter at least 6 characters. |
| projects | project | | description | input | li#project_title_input | can't be blank |
| projects | project | too short | description | input | li#project_description_input | Please enter at least 12 characters. |
| projects | project | blah/ | location | input | li#project_location_input | Must be a valid project location on your system. |
| steps | step | | title | input | li#step_title_input | can't be blank |
| steps | step | we have a new step | title | input | li#step_title_input | must start with Given, When or Then |
| steps | step | foo | title | input | li#step_title_input | Please enter at least 12 characters. |
| stories | story | blah | scenario | input | li#story_scenario_input | Please enter at least 7 characters. |
| stories | story | | scenario | input | li#story_scenario_input | can't be blank |
| parking | resource | | name | input | li#resource_name_input | can't be blank |
| parking | resource | | name | input | li#resource_name_input | Please enter at least 3 characters. |
| parking | resource | | project | input | li#resource_project_input | can't be blank |
| parking | resource | | project | input | li#resource_project_input | Please enter at least 3 characters. |

# Relies on fixtures
Scenario: A feature must be unique
Given I can view the features page
When I click new features
And I fill in the feature form with duplicate data
Scenario Outline: There should not be any duplicate entries
When I am on "new <model>" page
And I fill in the <model> form with duplicate data
Then submit the form
And the feature information should be not saved
And the <model> information should not be saved
And the error message should be "has already been taken"

# Relies on fixtures
Scenario: If a story is not unique we need to display a error
Given I can view the stories page
When I use the "New Story" link
And I fill in the story form with duplicate data
Then submit the form
And the error message should be "has already been taken"

Scenario: A story invalid if it does not have 'Given' as a prefix
Given I can view the steps page
When I click new steps
And we fill in the step title with 'we have a new step'
Then submit the form
Then the step should be not saved
And the message 'Title must start with Given, When or Then' should be displayed
Examples: List of models that must be unique
| model |
| project |
| feature |
| story |

0 comments on commit dd9249e

Please sign in to comment.