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_confirm_spec.rb

30 lines
868 B
Ruby
Raw Normal View History

2013-04-01 18:41:55 -04:00
Capybara::SpecHelper.spec '#accept_confirm', :requires => [:modals] do
before do
@session.visit('/with_js')
end
it "should accept the confirm" do
@session.accept_confirm do
@session.click_link('Open confirm')
end
expect(@session).to have_xpath("//a[@id='open-confirm' and @confirmed='true']")
end
it "should return the message presented" do
message = @session.accept_confirm do
@session.click_link('Open confirm')
end
expect(message).to eq('Confirm opened')
end
2015-09-28 19:19:04 -04:00
2015-07-21 20:43:11 -04:00
it "should work with nested modals" do
2015-09-28 19:19:04 -04:00
expect {
@session.dismiss_confirm 'Are you really sure?' do
@session.accept_confirm 'Are you sure?' do
@session.click_link('Open check twice')
end
end
}.not_to raise_error
expect(@session).to have_xpath("//a[@id='open-twice' and @confirmed='false']")
end
2013-04-01 18:41:55 -04:00
end