File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,33 @@ module RSpec::Rails
12
12
end
13
13
end
14
14
15
+ context "with use_transactional_tests set to true" do
16
+ it "works with #uses_transaction helper" do
17
+ group = RSpec ::Core ::ExampleGroup . describe do
18
+ include FixtureSupport
19
+ self . use_transactional_tests = true
20
+
21
+ uses_transaction "doesn't run in transaction"
22
+
23
+ it "doesn't run in transaction" do
24
+ expect ( ActiveRecord ::Base . connection . transaction_open? ) . to eq ( false )
25
+ end
26
+
27
+ it "runs in transaction" do
28
+ expect ( ActiveRecord ::Base . connection . transaction_open? ) . to eq ( true )
29
+ end
30
+ end
31
+
32
+ expect_to_pass ( group )
33
+ end
34
+
35
+ def expect_to_pass ( group )
36
+ result = group . run ( failure_reporter )
37
+ failure_reporter . exceptions . map { |e | raise e }
38
+ expect ( result ) . to be true
39
+ end
40
+ end
41
+
15
42
it "will allow #setup_fixture to run successfully" , skip : Rails . version . to_f <= 6.0 do
16
43
group = RSpec ::Core ::ExampleGroup . describe do
17
44
include FixtureSupport
You can’t perform that action at this time.
0 commit comments