Skip to content

Commit

Permalink
Fix with_revert spec helper
Browse files Browse the repository at this point in the history
This works with either `adapter.materialize_transactions` before
the savepoint creation or by skipping the savepoint entirely and
reverting the migration by raising `ActiveRecord::Rollback`

Close #179

Ref: rails/rails@57bc28f rails/rails#44576
  • Loading branch information
tagliala committed Oct 8, 2022
1 parent 081e79a commit 6888fa2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions spec/support/time_machine/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def adapter

def with_revert
adapter.transaction do
adapter.materialize_transactions if adapter.respond_to?(:materialize_transactions)
adapter.create_savepoint 'revert'

yield
Expand Down

0 comments on commit 6888fa2

Please sign in to comment.