summaryrefslogtreecommitdiff
path: root/spec/support/capybara.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-06-16 17:23:49 +0200
committerRémy Coutable <remy@rymai.me>2017-06-16 17:23:49 +0200
commitabc5d1d0a52619b56e931007cf7c136732aae198 (patch)
treeefd234040d7b0f11ba3e8c14e2d2ef5dde756f1f /spec/support/capybara.rb
parent5f42009f8dcc29d559ee415e92c88858e361f063 (diff)
downloadgitlab-ce-abc5d1d0a52619b56e931007cf7c136732aae198.tar.gz
Call Capybara.reset_sessions! before block_and_wait_for_requests_complete33779-reset-session-before-blocking-requests
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 Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/support/capybara.rb')
-rw-r--r--spec/support/capybara.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb
index c34e76fa72f..4aa81a03558 100644
--- a/spec/support/capybara.rb
+++ b/spec/support/capybara.rb
@@ -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