File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -1674,3 +1674,31 @@ def marshal_fixture_path(file_name)
16741674 )
16751675 end
16761676end
1677+
1678+ class BasePreventWritesTest < ActiveRecord ::TestCase
1679+ # We open one transaction, not two. Same as original but checking one query
1680+ coerce_tests! %r{an empty transaction does not raise if preventing writes}
1681+ test "an empty transaction does not raise if preventing writes coerced" do
1682+ ActiveRecord ::Base . while_preventing_writes do
1683+ assert_queries ( 1 , ignore_none : true ) do
1684+ Bird . transaction do
1685+ ActiveRecord ::Base . connection . materialize_transactions
1686+ end
1687+ end
1688+ end
1689+ end
1690+ end
1691+
1692+ class BasePreventWritesLegacyTest < ActiveRecord ::TestCase
1693+ # We open one transaction, not two. Same as original but checking one query
1694+ coerce_tests! %r{an empty transaction does not raise if preventing writes}
1695+ test "an empty transaction does not raise if preventing writes coerced" do
1696+ ActiveRecord ::Base . connection_handler . while_preventing_writes do
1697+ assert_queries ( 1 , ignore_none : true ) do
1698+ Bird . transaction do
1699+ ActiveRecord ::Base . connection . materialize_transactions
1700+ end
1701+ end
1702+ end
1703+ end
1704+ end
You can’t perform that action at this time.
0 commit comments