Module: Mack::Testing

Defined in:
lib/mack-active_record/test_extensions.rb,
lib/mack-active_record/test_extensions.rb

Overview

:nodoc:

Constant Summary collapse

AR_TEST_EXTENSIONS =
1

Instance Method Summary collapse

Instance Method Details

#rollback_transactionObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/mack-active_record/test_extensions.rb', line 14

def rollback_transaction
  begin
    ActiveRecord::Base.transaction do
      yield if block_given?
      raise "Rollback!"
    end
  rescue => ex
    # we need to do this so we can throw up actual errors!
    unless ex.to_s == "Rollback!"
      raise ex
    end
  end
end