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

Version Path
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/lib/database_cleaner/data_mapper/transaction.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/lib/database_cleaner/data_mapper/transaction.rb
autocompl-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-1.5.3 lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-1.5.2 lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-1.5.1 lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-1.5.0 lib/database_cleaner/data_mapper/transaction.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/database_cleaner-1.4.1/lib/database_cleaner/data_mapper/transaction.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/database_cleaner-1.4.1/lib/database_cleaner/data_mapper/transaction.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/database_cleaner-1.4.1/lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-1.4.1 lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-1.4.0 lib/database_cleaner/data_mapper/transaction.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/database_cleaner-1.2.0/lib/database_cleaner/data_mapper/transaction.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/database_cleaner-1.2.0/lib/database_cleaner/data_mapper/transaction.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/database_cleaner-1.2.0/lib/database_cleaner/data_mapper/transaction.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/database_cleaner-1.2.0/lib/database_cleaner/data_mapper/transaction.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/database_cleaner-1.2.0/lib/database_cleaner/data_mapper/transaction.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/database_cleaner-1.2.0/lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-1.3.0 lib/database_cleaner/data_mapper/transaction.rb
database_cleaner-1.2.0 lib/database_cleaner/data_mapper/transaction.rb