Commit abc5d1d0 authored by Rémy Coutable's avatar Rémy Coutable

Call Capybara.reset_sessions! before block_and_wait_for_requests_complete

capybara/rspec already calls Capybara.reset_sessions! in an
`after` hook, but `block_and_wait_for_requests_complete` is called
before it so by calling it explicitely here, we prevent any new
requests from being fired.
See
https://github.com/teamcapybara/capybara/blob/ffb41cfad620de1961bb49b1562a9fa9b28c0903/lib/capybara/rspec.rb#L20-L25Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 5f42009f
......@@ -35,4 +35,13 @@ RSpec.configure do |config|
TestEnv.eager_load_driver_server
$capybara_server_already_started = true
end
config.after(:each, :js) do
# capybara/rspec already calls Capybara.reset_sessions! in an `after` hook,
# but `block_and_wait_for_requests_complete` is called before it so by
# calling it explicitely here, we prevent any new requests from being fired
# See https://github.com/teamcapybara/capybara/blob/ffb41cfad620de1961bb49b1562a9fa9b28c0903/lib/capybara/rspec.rb#L20-L25
Capybara.reset_sessions!
block_and_wait_for_requests_complete
end
end
......@@ -53,9 +53,3 @@ module WaitForRequests
Capybara.current_driver == Capybara.javascript_driver
end
end
RSpec.configure do |config|
config.after(:each, :js) do
block_and_wait_for_requests_complete
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment