Class: DatabaseCleaner::DataMapper::Transaction
- Inherits:
-
Object
- Object
- DatabaseCleaner::DataMapper::Transaction
- Defined in:
- lib/database_cleaner/data_mapper/transaction.rb
Instance Method Summary collapse
Instance Method Details
#clean(repo = :default) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/database_cleaner/data_mapper/transaction.rb', line 12 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 |
#start(repo = :default) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/database_cleaner/data_mapper/transaction.rb', line 4 def start(repo = :default) DataMapper.repository(repo) do |r| transaction = DataMapper::Transaction.new(r) transaction.begin r.adapter.push_transaction(transaction) end end |