Module: Mack::Testing

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

Overview

:nodoc:

Defined Under Namespace

Classes: DmTestTransactionWrapper

Instance Method Summary collapse

Instance Method Details

#rollback_transactionObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/mack-data_mapper/test_extensions.rb', line 20

def rollback_transaction
  begin
    Mack::Testing::DmTestTransactionWrapper.transaction do
    # DataMapper::Transaction.new.commit 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