Module: DatabaseCleaner::ConnectionAdapters::AbstractAdapter
- Defined in:
- lib/database_cleaner/active_record/truncation.rb
Instance Method Summary collapse
- #database_cleaner_table_cache ⇒ Object
-
#database_cleaner_view_cache ⇒ Object
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.
- #truncate_table(table_name) ⇒ Object
- #truncate_tables(tables) ⇒ Object
Instance Method Details
#database_cleaner_table_cache ⇒ Object
28 29 30 31 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 28 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_cache ⇒ Object
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
24 25 26 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 24 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
33 34 35 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 33 def truncate_table(table_name) raise NotImplementedError end |
#truncate_tables(tables) ⇒ Object
37 38 39 40 41 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 37 def truncate_tables(tables) tables.each do |table_name| self.truncate_table(table_name) end end |