Module: MR::FakeRecord::Persistence::TransactionMethods

Included in:
MR::FakeRecord
Defined in:
lib/mr/fake_record/persistence.rb

Overview

this is broken into a separate module so ‘FakeRecord` can extend it and provide easy access to the `transaction` method (for stubbing, etc)

Instance Method Summary collapse

Instance Method Details

#transactionObject

ActiveRecord methods



29
30
31
32
33
34
35
36
# File 'lib/mr/fake_record/persistence.rb', line 29

def transaction
  begin
    yield if block_given?
  rescue ActiveRecord::Rollback
    # activerecord swallows rollback exceptions, they are only intended as a
    # mechanism to rollback the transaction
  end
end