Sha256: 40e7abbdf66c42dbfd3d017a35d1af57941a56427f23cb50115a89ee5768cfc7

Contents?: true

Size: 784 Bytes

Versions: 1

Compression:

Stored size: 784 Bytes

Contents

module DatabaseCleaner::ActiveRecord
  class Transaction

    def start
      DatabaseCleaner::ActiveRecord.connection_klasses.each do |klass|
        if klass.connection.respond_to?(:increment_open_transactions)
          klass.connection.increment_open_transactions
        else
          klass.__send__(:increment_open_transactions)
        end

        klass.connection.begin_db_transaction
      end
    end


    def clean
      DatabaseCleaner::ActiveRecord.connection_klasses.each do |klass|
        klass.connection.rollback_db_transaction

        if klass.connection.respond_to?(:decrement_open_transactions)
          klass.connection.decrement_open_transactions
        else
          klass.__send__(:decrement_open_transactions)
        end
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jonrowe-database_cleaner-0.5.2 lib/database_cleaner/active_record/transaction.rb