Skip to content

Commit

Permalink
fix savepoint test, it seems transaction needs to be materialized bef…
Browse files Browse the repository at this point in the history
…ore creating a savepoint

change relates to
  rails/rails@3f19431

materilaization is trigger by executing any query inside the transaction
  • Loading branch information
JesseChavez committed Jul 22, 2024
1 parent 709f2c2 commit 8c9fd86
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/transaction_test_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,14 @@ def test_using_named_savepoints

def test_current_savepoints_name
MyUser.transaction do
MyUser.delete_all # Dirty the transaction to force a savepoint below

assert_nil MyUser.connection.current_savepoint_name
assert_nil MyUser.connection.current_transaction.savepoint_name

MyUser.transaction(:requires_new => true) do
MyUser.delete_all # Dirty the transaction to force a savepoint below

assert_equal "active_record_1", MyUser.connection.current_savepoint_name
assert_equal "active_record_1", MyUser.connection.current_transaction.savepoint_name

Expand Down

0 comments on commit 8c9fd86

Please sign in to comment.