added tests for flash messages on reshares
This commit is contained in:
parent
0dee8aae36
commit
979eb66e44
3 changed files with 34 additions and 6 deletions
|
|
@ -18,9 +18,5 @@ Feature: public repost
|
||||||
And I preemptively confirm the alert
|
And I preemptively confirm the alert
|
||||||
And I follow "Reshare"
|
And I follow "Reshare"
|
||||||
And I wait for the ajax to finish
|
And I wait for the ajax to finish
|
||||||
And I wait for 2 seconds
|
Then I should see a flash message indicating success
|
||||||
|
And I should see a flash message containing "successfully"
|
||||||
When I am on "alice@alice.alice"'s page
|
|
||||||
Then I should see "reshare this!"
|
|
||||||
Then I should see a ".reshare"
|
|
||||||
And I should see "Bob"
|
|
||||||
|
|
|
||||||
|
|
@ -204,3 +204,15 @@ end
|
||||||
Then /^I should not see ajax loader on deletion link place$/ do
|
Then /^I should not see ajax loader on deletion link place$/ do
|
||||||
page.evaluate_script("$('.hide_loader').first().css('display')").should == "none"
|
page.evaluate_script("$('.hide_loader').first().css('display')").should == "none"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Then /^I should see a flash message indicating success$/ do
|
||||||
|
flash_message_success?
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^I should see a flash message indicating failure$/ do
|
||||||
|
flash_message_failure?
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^I should see a flash message containing "(.+)"$/ do |text|
|
||||||
|
flash_message_containing? text
|
||||||
|
end
|
||||||
|
|
|
||||||
20
features/support/application_cuke_helpers.rb
Normal file
20
features/support/application_cuke_helpers.rb
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
module ApplicationCukeHelpers
|
||||||
|
def flash_message_success?
|
||||||
|
flash_message("notice").visible?
|
||||||
|
end
|
||||||
|
|
||||||
|
def flash_message_failure?
|
||||||
|
flash_message("error").visible?
|
||||||
|
end
|
||||||
|
|
||||||
|
def flash_message_containing?(text)
|
||||||
|
flash_message.should have_content(text)
|
||||||
|
end
|
||||||
|
|
||||||
|
def flash_message(selector=".message")
|
||||||
|
selector = "#flash_#{selector}" unless selector == ".message"
|
||||||
|
find(selector)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
World(ApplicationCukeHelpers)
|
||||||
Loading…
Reference in a new issue