Skip to content

Commit 1383039

Browse files
committed
fix savepoint test, it seems transaction needs to be materialized before creating a savepoint
change relates to rails/rails@3f19431 materilaization is trigger by executing any query inside the transaction Cherry-picked from my fork
1 parent 90e579f commit 1383039

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/transaction_test_methods.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,14 @@ def test_using_named_savepoints
206206

207207
def test_current_savepoints_name
208208
MyUser.transaction do
209+
MyUser.delete_all # Dirty the transaction to force a savepoint below
210+
209211
assert_nil MyUser.connection.current_savepoint_name
210212
assert_nil MyUser.connection.current_transaction.savepoint_name
211213

212214
MyUser.transaction(:requires_new => true) do
215+
MyUser.delete_all # Dirty the transaction to force a savepoint below
216+
213217
assert_equal "active_record_1", MyUser.connection.current_savepoint_name
214218
assert_equal "active_record_1", MyUser.connection.current_transaction.savepoint_name
215219

0 commit comments

Comments
 (0)