Sha256: 48f14ed4ac8ac51992305e1a2dbe5eb74e8854ef77c78cffb3e0c493ea3ecaa7

Contents?: true

Size: 538 Bytes

Versions: 22

Compression:

Stored size: 538 Bytes

Contents

module DatabaseCleaner::DataMapper
  class Transaction

    def start(repo = :default)
      DataMapper.repository(repo) do |r|
        transaction = DataMapper::Transaction.new(r)
        transaction.begin
        r.adapter.push_transaction(transaction)
      end
    end

    def clean(repo = :default)
      DataMapper.repository(repo) do |r|
        adapter = r.adapter
        while adapter.current_transaction
          adapter.current_transaction.rollback
          adapter.pop_transaction
        end
      end
    end

  end
end

Version data entries

22 entries across 22 versions & 11 rubygems

Version Path
HusseinMorsy-database_cleaner-0.2.2 lib/database_cleaner/data_mapper/transaction.rb
adzap-database_cleaner-0.2.3 lib/database_cleaner/data_mapper/transaction.rb
bmabey-database_cleaner-0.2.0 lib/database_cleaner/data_mapper/transaction.rb
bmabey-database_cleaner-0.2.1 lib/database_cleaner/data_mapper/transaction.rb
bmabey-database_cleaner-0.2.2 lib/database_cleaner/data_mapper/transaction.rb
bmabey-database_cleaner-0.2.3 lib/database_cleaner/data_mapper/transaction.rb
darrell-database_cleaner-0.2.3.2 lib/database_cleaner/data_mapper/transaction.rb
yozhyk-database_cleaner-0.2.4 lib/database_cleaner/data_mapper/transaction.rb
bitfluent-database_cleaner-0.5.2 lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-0.5.2 lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-0.5.1 lib/database_cleaner/data_mapper/transaction.rb
jonrowe-database_cleaner-0.5.2 lib/database_cleaner/data_mapper/transaction.rb
saimonmoore-database_cleaner-0.5.0 lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-0.5.0 lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-0.4.3 lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-0.4.2 lib/database_cleaner/data_mapper/transaction.rb
tooky-database_cleaner-0.4.1 lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-0.4.1 lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-0.4.0 lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-0.3.0 lib/database_cleaner/data_mapper/transaction.rb