Skip to content

Commit 0142b1e

Browse files
authored
Merge pull request #2733 from eugeneius/setup_fixtures
Fix failing fixture support test on Rails main
2 parents 40af4f0 + 5d4d0cb commit 0142b1e

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
@@ -39,14 +39,21 @@ module RSpec::Rails
3939
end
4040
end
4141

42-
it "will allow #setup_fixture to run successfully" do
43-
group = RSpec::Core::ExampleGroup.describe do
44-
include FixtureSupport
42+
context "with use_transactional_tests set to false" do
43+
it "does not wrap the test in a transaction" do
44+
allow(RSpec.configuration).to receive(:use_transactional_fixtures) { true }
45+
group = RSpec::Core::ExampleGroup.describe do
46+
include FixtureSupport
4547

46-
self.use_transactional_tests = false
47-
end
48+
self.use_transactional_tests = false
49+
50+
it "doesn't run in transaction" do
51+
expect(ActiveRecord::Base.connection.transaction_open?).to eq(false)
52+
end
53+
end
4854

49-
expect { group.new.setup_fixtures }.to_not raise_error
55+
expect_to_pass(group)
56+
end
5057
end
5158

5259
it "handles namespaced fixtures" do

0 commit comments

Comments
 (0)