From 38aef20b6486be7f6c0820fbbea23d537c805d8f Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Tue, 20 Feb 2024 10:38:39 +0000 Subject: [PATCH] Merge pull request #2733 from eugeneius/setup_fixtures Fix failing fixture support test on Rails main --- spec/rspec/rails/fixture_support_spec.rb | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/spec/rspec/rails/fixture_support_spec.rb b/spec/rspec/rails/fixture_support_spec.rb index 9d24b616d..236c8df28 100644 --- a/spec/rspec/rails/fixture_support_spec.rb +++ b/spec/rspec/rails/fixture_support_spec.rb @@ -45,14 +45,21 @@ module RSpec::Rails end end - it "will allow #setup_fixture to run successfully" do - group = RSpec::Core::ExampleGroup.describe do - include FixtureSupport + context "with use_transactional_tests set to false" do + it "does not wrap the test in a transaction" do + allow(RSpec.configuration).to receive(:use_transactional_fixtures) { true } + group = RSpec::Core::ExampleGroup.describe do + include FixtureSupport - self.use_transactional_tests = false - end + self.use_transactional_tests = false + + it "doesn't run in transaction" do + expect(ActiveRecord::Base.connection.transaction_open?).to eq(false) + end + end - expect { group.new.setup_fixtures }.to_not raise_error + expect_to_pass(group) + end end it "handles namespaced fixtures" do