Sha256: 63244e48eb4a103370c668c7ed74fc38977884c5b410db76319946349a568a56

Contents?: true

Size: 448 Bytes

Versions: 5

Compression:

Stored size: 448 Bytes

Contents

class ActiveRecordTransactionerTestClass
  attr_reader :save_called
  
  def initialize
    @save_called = false
  end
  
  def self.transaction
    Thread.current[:trans] = self.name
    
    begin
      yield
    ensure
      Thread.current[:trans] = nil
    end
  end
  
  def save!
    raise "Failure - no transaction: #{Thread.current[:trans]}, #{self.class.name}" if Thread.current[:trans] != self.class.name
    @save_called = true
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active-record-transactioner-0.0.4 spec/test_classes/active-record-transactioner-test-class.rb
active-record-transactioner-0.0.3 spec/test_classes/active-record-transactioner-test-class.rb
active-record-transactioner-0.0.2 spec/test_classes/active-record-transactioner-test-class.rb
active-record-transactioner-0.0.1 spec/test_classes/active-record-transactioner-test-class.rb
active-record-transactioner-0.0.0 spec/test_classes/active-record-transactioner-test-class.rb