DEV: Multisite tests didn't fail anymore

The change in 9ba8bfb1aa swallowed all exceptions (even syntax errors) which made them appear to pass even if they failed.
This commit is contained in:
Gerhard Schlager 2019-01-24 21:36:45 +01:00
parent c94a2bc69b
commit 7e9da812ea
1 changed files with 6 additions and 1 deletions

View File

@ -210,13 +210,18 @@ RSpec.configure do |config|
# force a rollback after using a multisite connection.
def test_multisite_connection(name)
RailsMultisite::ConnectionManagement.with_connection(name) do
spec_exception = nil
ActiveRecord::Base.transaction do
begin
yield
rescue Exception => spec_exception
ensure
throw raise ActiveRecord::Rollback
raise ActiveRecord::Rollback
end
end
raise spec_exception if spec_exception
end
end