summaryrefslogtreecommitdiff
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
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>
-rw-r--r--spec/support/capybara.rb9
-rw-r--r--spec/support/wait_for_requests.rb6
2 files changed, 9 insertions, 6 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
diff --git a/spec/support/wait_for_requests.rb b/spec/support/wait_for_requests.rb
index 1cbe609c0e0..b5c3c0f55b8 100644
--- a/spec/support/wait_for_requests.rb
+++ b/spec/support/wait_for_requests.rb
@@ -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