Fix DB corruption in system tests after exceptions
This is a known bug in Rails, fixed in the Rails 5.2 and Rails 6.x branches: https://github.com/rails/rails/pull/32293/commits/5c4e1338
This commit is contained in:
@@ -19,6 +19,18 @@ Warden.test_mode!
|
|||||||
|
|
||||||
ActiveRecord::Migration.maintain_test_schema!
|
ActiveRecord::Migration.maintain_test_schema!
|
||||||
|
|
||||||
|
# Monkey patch from https://github.com/rails/rails/pull/32293
|
||||||
|
# Remove when we upgrade to Rails 5.2
|
||||||
|
require "action_dispatch/system_testing/test_helpers/setup_and_teardown"
|
||||||
|
module ActionDispatch::SystemTesting::TestHelpers::SetupAndTeardown
|
||||||
|
def after_teardown
|
||||||
|
take_failed_screenshot
|
||||||
|
Capybara.reset_sessions!
|
||||||
|
ensure
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.infer_spec_type_from_file_location!
|
config.infer_spec_type_from_file_location!
|
||||||
config.after do
|
config.after do
|
||||||
|
|||||||
Reference in New Issue
Block a user