Sha256: 76514626140a8b89da1a5e65a154b40d0266e22b491495b7956821bb8799764a
Contents?: true
Size: 756 Bytes
Versions: 48
Compression:
Stored size: 756 Bytes
Contents
require 'database_cleaner/data_mapper/base' require 'database_cleaner/generic/transaction' module DatabaseCleaner::DataMapper class Transaction include ::DatabaseCleaner::DataMapper::Base include ::DatabaseCleaner::Generic::Transaction def start(repository = self.db) ::DataMapper.repository(repository) do |r| transaction = DataMapper::Transaction.new(r) transaction.begin r.adapter.push_transaction(transaction) end end def clean(repository = self.db) ::DataMapper.repository(repository) do |r| adapter = r.adapter while adapter.current_transaction adapter.current_transaction.rollback adapter.pop_transaction end end end end end
Version data entries
48 entries across 43 versions & 7 rubygems