Skip to content

Instantly share code, notes, and snippets.

@chrishunt
Created July 9, 2013 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrishunt/5959064 to your computer and use it in GitHub Desktop.
Save chrishunt/5959064 to your computer and use it in GitHub Desktop.
Test after_commit hooks 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment