another attempt at stabilizing features/signs_up.feature

This commit is contained in:
Jonne Haß 2013-08-04 17:01:12 +02:00
parent ba3d60b00f
commit 274faebdd1
3 changed files with 10 additions and 9 deletions

View file

@ -11,7 +11,7 @@
}; };
this.render = function(result) { this.render = function(result) {
self.flashMessages().removeClass("expose").hide(); self.flashMessages().removeClass("expose").remove();
$("<div/>", { $("<div/>", {
id: result.success ? "flash_notice" : "flash_error" id: result.success ? "flash_notice" : "flash_error"

View file

@ -278,11 +278,11 @@ Then /^I should not see ajax loader on deletion link place$/ do
end end
Then /^I should see a flash message indicating success$/ do Then /^I should see a flash message indicating success$/ do
flash_message_success? flash_message_success?.should be_true
end end
Then /^I should see a flash message indicating failure$/ do Then /^I should see a flash message indicating failure$/ do
flash_message_failure? flash_message_failure?.should be_true
end end
Then /^I should see a flash message containing "(.+)"$/ do |text| Then /^I should see a flash message containing "(.+)"$/ do |text|

View file

@ -1,19 +1,20 @@
module ApplicationCukeHelpers module ApplicationCukeHelpers
def flash_message_success? def flash_message_success?
flash_message("notice").visible? flash_message(selector: "notice").visible?
end end
def flash_message_failure? def flash_message_failure?
flash_message("error").visible? flash_message(selector: "error").visible?
end end
def flash_message_containing?(text) def flash_message_containing?(text)
flash_message.should have_content(text) flash_message(text: text).should be_visible
end end
def flash_message(selector=".message") def flash_message(opts={})
selector = "#flash_#{selector}" unless selector == ".message" selector = opts.delete(:selector)
find(selector, match: :first) selector &&= "#flash_#{selector}"
find(selector || '.message', {match: :first}.merge(opts))
end end
end end