Module: DatabaseCleaner::ConnectionAdapters::AbstractAdapter

Defined in:
lib/database_cleaner/active_record/truncation.rb

Instance Method Summary collapse

Instance Method Details

#database_cleaner_table_cacheObject



25
26
27
28
# File 'lib/database_cleaner/active_record/truncation.rb', line 25

def database_cleaner_table_cache
  # the adapters don't do caching (#130) but we make the assumption that the list stays the same in tests
  @database_cleaner_tables ||= tables
end

#database_cleaner_view_cacheObject

used to be called views but that can clash with gems like schema_plus this gem is not meant to be exposing such an extra interface any way



22
23
24
# File 'lib/database_cleaner/active_record/truncation.rb', line 22

def database_cleaner_view_cache
  @views ||= select_values("select table_name from information_schema.views where table_schema = '#{current_database}'") rescue []
end

#truncate_table(table_name) ⇒ Object

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/database_cleaner/active_record/truncation.rb', line 30

def truncate_table(table_name)
  raise NotImplementedError
end

#truncate_tables(tables) ⇒ Object



34
35
36
37
38
# File 'lib/database_cleaner/active_record/truncation.rb', line 34

def truncate_tables(tables)
  tables.each do |table_name|
    self.truncate_table(table_name)
  end
end