Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmaitchison/5168104 to your computer and use it in GitHub Desktop.
Save cmaitchison/5168104 to your computer and use it in GitHub Desktop.
testing after_commit hooks with transactional fixtures in Rails 4
require 'active_record/connection_adapters/abstract/transaction'
module ActiveRecord
module ConnectionAdapters
class SavepointTransaction < OpenTransaction
def perform_commit_with_transactional_fixtures
commit_records if number == 1
perform_commit_without_transactional_fixtures
end
alias_method_chain :perform_commit, :transactional_fixtures
end
end
end
@pbonnell
Copy link

tx for this fork. found while upgrading 3.1.2 app to Rails4

@ProGM
Copy link

ProGM commented Nov 9, 2015

It's not working for Rails 4.2...

@ViliusLuneckas
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment