From 7b65fdf77c0a435231e8ba67c309204699082e60 Mon Sep 17 00:00:00 2001 From: Fabian Rodriguez Date: Wed, 28 Aug 2013 10:26:16 -0300 Subject: [PATCH] add missing shoulds --- features/desktop/signs_up.feature | 14 +++----------- features/step_definitions/custom_web_steps.rb | 11 ----------- features/support/publishing_cuke_helpers.rb | 8 ++++---- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/features/desktop/signs_up.feature b/features/desktop/signs_up.feature index 22ed067fb..5839d5cf9 100644 --- a/features/desktop/signs_up.feature +++ b/features/desktop/signs_up.feature @@ -51,24 +51,16 @@ Feature: new user registration And I fill in the following: | user_username | $%&(/&%$&/=)(/ | And I press "Continue" - - Then following fields should have validation errors: - | user_username | - | user_email | - | user_password | + Then I should see a flash message containing "Email can't be blank - Password can't be blank - Username is invalid." When I fill in the following: | user_username | valid_user | | user_email | this is not a valid email $%&/()( | And I press "Continue" - - Then following fields should have validation errors: - | user_email | - | user_password | + Then I should see a flash message containing "Email is invalid - Password can't be blank" When I fill in the following: | user_email | valid@email.com | | user_password | 1 | And I press "Continue" - Then following field should have validation error: - | user_password | + Then I should see a flash message containing "Password doesn't match confirmation - Password is too short (minimum is 6 characters)" diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index 1844cc095..d1fe7ddf5 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -60,17 +60,6 @@ And /^I submit the form$/ do find("input[type='submit']").click end -Then /^the "([^"]*)" field should have a validation error$/ do |field| - find_field(field).has_xpath?(".//ancestor::div[contains(@class, 'control-group')]/div[contains(@class, 'field_with_errors')]") -end - - -Then /^following field[s]? should have validation error[s]?:$/ do |fields| - fields.raw.each do |field| - step %{the "#{field[0]}" field should have a validation error} - end -end - And /^I expand the publisher$/ do click_publisher end diff --git a/features/support/publishing_cuke_helpers.rb b/features/support/publishing_cuke_helpers.rb index fe3bb6a8e..b694a5f93 100644 --- a/features/support/publishing_cuke_helpers.rb +++ b/features/support/publishing_cuke_helpers.rb @@ -26,13 +26,13 @@ module PublishingCukeHelpers def first_post_collapsed? find(".stream_element .collapsible", match: :first).should have_css(".expander") - find(".stream_element .collapsible", match: :first).has_selector?(".collapsed") + page.should have_css(".stream_element .collapsible.collapsed", match: :first) end def first_post_expanded? - has_no_css?(".stream_element .expander", match: :first).should be_true - find(".stream_element .collapsible", match: :first).has_no_selector?(".collapsed") - find(".stream_element .collapsible", match: :first).has_selector?(".opened") + page.should have_no_css(".stream_element .expander", match: :first) + page.should have_no_css(".stream_element .collapsible.collapsed", match: :first) + page.should have_css(".stream_element .collapsible.opened", match: :first) end def first_post_text