Skip to content

Commit 38aef20

Browse files
committed
Merge pull request #2733 from eugeneius/setup_fixtures
Fix failing fixture support test on Rails main
1 parent 453e948 commit 38aef20

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

spec/rspec/rails/fixture_support_spec.rb

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,21 @@ module RSpec::Rails
4545
end
4646
end
4747

48-
it "will allow #setup_fixture to run successfully" do
49-
group = RSpec::Core::ExampleGroup.describe do
50-
include FixtureSupport
48+
context "with use_transactional_tests set to false" do
49+
it "does not wrap the test in a transaction" do
50+
allow(RSpec.configuration).to receive(:use_transactional_fixtures) { true }
51+
group = RSpec::Core::ExampleGroup.describe do
52+
include FixtureSupport
5153

52-
self.use_transactional_tests = false
53-
end
54+
self.use_transactional_tests = false
55+
56+
it "doesn't run in transaction" do
57+
expect(ActiveRecord::Base.connection.transaction_open?).to eq(false)
58+
end
59+
end
5460

55-
expect { group.new.setup_fixtures }.to_not raise_error
61+
expect_to_pass(group)
62+
end
5663
end
5764

5865
it "handles namespaced fixtures" do

0 commit comments

Comments
 (0)