summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-06-22 03:39:40 +0000
committerRobert Speicher <robert@gitlab.com>2017-06-22 03:39:40 +0000
commit1a9317b821bc625eaad8550298d288bfc29e53d7 (patch)
tree584457e753d36e996cea44775ed20eedfd485fc8 /spec
parent340b8a10bb184b3a54306d1415d9fa4a6c5fbe7c (diff)
parentaf5bf71365712f1102eccc22aa3af0c4b5c1860d (diff)
downloadgitlab-ce-1a9317b821bc625eaad8550298d288bfc29e53d7.tar.gz
Merge branch 'dm-restore-capybara-screenshot' into 'master'
Don't reset the session when the example failed to fix capybara-screenshot See merge request !12370
Diffstat (limited to 'spec')
-rw-r--r--spec/support/capybara.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb
index 4aa81a03558..3e5d6cf1364 100644
--- a/spec/support/capybara.rb
+++ b/spec/support/capybara.rb
@@ -36,12 +36,13 @@ RSpec.configure do |config|
$capybara_server_already_started = true
end
- config.after(:each, :js) do
+ config.after(:each, :js) do |example|
# 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!
+ # We don't reset the session when the example failed, because we need capybara-screenshot to have access to it.
+ Capybara.reset_sessions! unless example.exception
block_and_wait_for_requests_complete
end
end