From dd9249e8228a2c12c3025c66c65fd6cc272f870c Mon Sep 17 00:00:00 2001 From: Yomi Colledge Date: Fri, 16 Jul 2010 13:29:09 +0100 Subject: [PATCH] Moved our custom step title validation to our validation scenario outline --- features/plain/form_validations.feature | 88 ++++++++++--------------- 1 file changed, 34 insertions(+), 54 deletions(-) diff --git a/features/plain/form_validations.feature b/features/plain/form_validations.feature index ad49ad76..f245cb52 100644 --- a/features/plain/form_validations.feature +++ b/features/plain/form_validations.feature @@ -12,62 +12,42 @@ Feature: Validation of forms And I should see "" within "" 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 " page + And I fill in the form with duplicate data Then submit the form - And the feature information should be not saved + And the 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 | \ No newline at end of file