From 274faebdd1630c7bc06860095c9acba3cc2c29eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= Date: Sun, 4 Aug 2013 17:01:12 +0200 Subject: [PATCH] another attempt at stabilizing features/signs_up.feature --- app/assets/javascripts/widgets/flash-messages.js | 2 +- features/step_definitions/custom_web_steps.rb | 4 ++-- features/support/application_cuke_helpers.rb | 13 +++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/widgets/flash-messages.js b/app/assets/javascripts/widgets/flash-messages.js index bca6ad31e..5c2dcf7e4 100644 --- a/app/assets/javascripts/widgets/flash-messages.js +++ b/app/assets/javascripts/widgets/flash-messages.js @@ -11,7 +11,7 @@ }; this.render = function(result) { - self.flashMessages().removeClass("expose").hide(); + self.flashMessages().removeClass("expose").remove(); $("
", { id: result.success ? "flash_notice" : "flash_error" diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index a2fc0d0fa..2f66a03c0 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -278,11 +278,11 @@ Then /^I should not see ajax loader on deletion link place$/ do end Then /^I should see a flash message indicating success$/ do - flash_message_success? + flash_message_success?.should be_true end Then /^I should see a flash message indicating failure$/ do - flash_message_failure? + flash_message_failure?.should be_true end Then /^I should see a flash message containing "(.+)"$/ do |text| diff --git a/features/support/application_cuke_helpers.rb b/features/support/application_cuke_helpers.rb index 337bc532e..b7a3b1b35 100644 --- a/features/support/application_cuke_helpers.rb +++ b/features/support/application_cuke_helpers.rb @@ -1,19 +1,20 @@ module ApplicationCukeHelpers def flash_message_success? - flash_message("notice").visible? + flash_message(selector: "notice").visible? end def flash_message_failure? - flash_message("error").visible? + flash_message(selector: "error").visible? end def flash_message_containing?(text) - flash_message.should have_content(text) + flash_message(text: text).should be_visible end - def flash_message(selector=".message") - selector = "#flash_#{selector}" unless selector == ".message" - find(selector, match: :first) + def flash_message(opts={}) + selector = opts.delete(:selector) + selector &&= "#flash_#{selector}" + find(selector || '.message', {match: :first}.merge(opts)) end end