Class: DatabaseCleaner::DataMapper::Truncation

Inherits:
TruncationBase show all
Defined in:
lib/database_cleaner/data_mapper/truncation.rb

Instance Method Summary collapse

Methods inherited from TruncationBase

#initialize, #start

Constructor Details

This class inherits a constructor from DatabaseCleaner::TruncationBase

Instance Method Details

#clean(repository = :default) ⇒ Object



121
122
123
124
125
126
127
128
# File 'lib/database_cleaner/data_mapper/truncation.rb', line 121

def clean(repository = :default)
  adapter = DataMapper.repository(repository).adapter
  adapter.disable_referential_integrity do
    tables_to_truncate.each do |table_name|
      adapter.truncate_table table_name
    end
  end
end