I am upgrading from rails 3.2.19 to rails 4.1.5, using rspec-rails 2.14.0.rc1 and capybara 2.4.1. All tests pass, and I only have one deprecation warning left:
[DEPRECATION] Capybara::Webkit::Driver#accept_js_confirms! is deprecated. Please use Capybara::Session#accept_confirm instead.
The line of code that is causing this is
page.driver.accept_js_confirms!
How do I change this line in order to eliminate the deprecation warning?
Given that the exception says:
Please use Capybara::Session#accept_confirm instead.
You probably want:
page.accept_confirm
Note that accept_confirm
is being run against the Capybara::Session instead of the driver.
This method expects a block that triggers the confirm alert to appear. For example:
page.accept_confirm do
click_link('that_opens_confirm')
end