File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -1845,12 +1845,17 @@ class TransactionIsolationTest < ActiveRecord::TestCase
18451845
18461846 private
18471847
1848- # The isolation level is set twice. Once by the transaction and once when the connection is reset
1849- # by `SQLServerRealTransaction#commit`. MySQL & PostgreSQL do not reset the connection and SQLite does support
1850- # transaction isolation.
1848+ # Need to handle the resetting of the isolation level in the adapter by `SQLServerRealTransaction#commit`.
1849+ # MySQL & PostgreSQL do not reset the connection and SQLite does support transaction isolation. After that we
1850+ # can assert the number of expected isolation level events .
18511851 undef_method :assert_begin_isolation_level_event
1852- def assert_begin_isolation_level_event ( events )
1853- assert_equal 2 , events . select { _1 . match ( /SET TRANSACTION ISOLATION LEVEL READ COMMITTED/ ) } . size
1852+ def assert_begin_isolation_level_event ( events , isolation : "READ COMMITTED" )
1853+ isolation_events = events . select { _1 . match ( /SET TRANSACTION ISOLATION LEVEL/ ) }
1854+
1855+ reset_starting_isolation_level_event = isolation_events . delete ( "SET TRANSACTION ISOLATION LEVEL READ COMMITTED" )
1856+ assert reset_starting_isolation_level_event . present?
1857+
1858+ assert_equal 1 , isolation_events . select { _1 . match ( /SET TRANSACTION ISOLATION LEVEL #{ isolation } / ) } . size
18541859 end
18551860end
18561861
You can’t perform that action at this time.
0 commit comments