Class: DatabaseCleaner::TruncationBase

Inherits:
Object
  • Object
show all
Defined in:
lib/database_cleaner/truncation_base.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ TruncationBase

Returns a new instance of TruncationBase.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/database_cleaner/truncation_base.rb', line 4

def initialize(options = {})
  if !options.empty? && !(options.keys - [:only, :except]).empty?
    raise ArgumentError, "The only valid options are :only and :except. You specified #{options.keys.join(',')}."
  end
  if options.has_key?(:only) && options.has_key?(:except)
    raise ArgumentError, "You may only specify either :only or :either.  Doing both doesn't really make sense does it?"
  end

  @only = options[:only]
  @tables_to_exclude = (options[:except] || [])
  if migration_storage = migration_storage_name
    @tables_to_exclude << migration_storage
  end
end

Instance Method Details

#cleanObject

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/database_cleaner/truncation_base.rb', line 23

def clean
  raise NotImplementedError
end

#startObject



19
20
21
# File 'lib/database_cleaner/truncation_base.rb', line 19

def start
  # no-op
end