Skip to content

Commit 9ccf8a3

Browse files
committed
Method updated
1 parent ebc8876 commit 9ccf8a3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

test/cases/coerced_tests.rb

+10-5
Original file line numberDiff line numberDiff 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
18551860
end
18561861

0 commit comments

Comments
 (0)