1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00
teamcapybara--capybara/lib/capybara/spec/session/accept_alert_spec.rb
2014-04-24 12:27:43 -05:00

35 lines
No EOL
983 B
Ruby

Capybara::SpecHelper.spec '#accept_alert', :requires => [:modals] do
before do
@session.visit('/with_js')
end
it "should accept the alert" do
@session.accept_alert do
@session.click_link('Open alert')
end
expect(@session).to have_xpath("//a[@id='open-alert' and @opened='true']")
end
it "should return the message presented" do
message = @session.accept_alert do
@session.click_link('Open alert')
end
expect(message).to eq('Alert opened')
end
context "with an asynchronous alert" do
it "should accept the alert" do
@session.accept_alert do
@session.click_link('Open delayed alert')
end
expect(@session).to have_xpath("//a[@id='open-delayed-alert' and @opened='true']")
end
it "should return the message presented" do
message = @session.accept_alert do
@session.click_link('Open delayed alert')
end
expect(message).to eq('Delayed alert opened')
end
end
end