FIX: Rollback when multisite tests raise exceptions
This commit is contained in:
parent
b76a1df27d
commit
23dd50316c
|
@ -264,19 +264,11 @@ RSpec.configure do |config|
|
||||||
# force a rollback after using a multisite connection.
|
# force a rollback after using a multisite connection.
|
||||||
def test_multisite_connection(name)
|
def test_multisite_connection(name)
|
||||||
RailsMultisite::ConnectionManagement.with_connection(name) do
|
RailsMultisite::ConnectionManagement.with_connection(name) do
|
||||||
spec_exception = nil
|
ActiveRecord::Base.transaction(joinable: false) do
|
||||||
|
|
||||||
ActiveRecord::Base.transaction do
|
|
||||||
begin
|
|
||||||
yield
|
yield
|
||||||
rescue Exception => spec_exception
|
|
||||||
ensure
|
|
||||||
raise ActiveRecord::Rollback
|
raise ActiveRecord::Rollback
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
raise spec_exception if spec_exception
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue