From 5e2edeb2f751d097f7b6c4a5e99722e901701e7a Mon Sep 17 00:00:00 2001 From: Daniel Waterworth Date: Thu, 6 Jul 2023 12:23:28 -0500 Subject: [PATCH] FIX: Set test transaction to before_all transaction (#22445) So that after_commit hooks work correctly for pre-fabricated objects. --- spec/rails_helper.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 12c952109a1..e498a3fd45f 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -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