FIX: Set test transaction to before_all transaction (#22445)

So that after_commit hooks work correctly for pre-fabricated objects.
This commit is contained in:
Daniel Waterworth 2023-07-06 12:23:28 -05:00 committed by GitHub
parent 8b80132f88
commit 5e2edeb2f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -149,7 +149,12 @@ module TestSetup
end
end
TestProf::BeforeAll.configure { |config| config.before(:begin) { TestSetup.test_setup } }
TestProf::BeforeAll.configure do |config|
config.after(:begin) do
TestSetup.test_setup
DB.test_transaction = ActiveRecord::Base.connection.current_transaction
end
end
if ENV["PREFABRICATION"] == "0"
module Prefabrication