Class: NestedScenarios

Inherits:
Object show all
Defined in:
lib/nested_scenarios.rb

Defined Under Namespace

Classes: Builder

Constant Summary collapse

@@record_name_fields =
%w( name username title )
@@skip_tables =
%w( schema_migrations )

Class Method Summary collapse

Class Method Details

.delete_tables(table_names = self.tables) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/nested_scenarios.rb', line 6

def self.delete_tables(table_names = self.tables)
  connection = ActiveRecord::Base.connection
  ActiveRecord::Base.silence do
    connection.disable_referential_integrity do
      (table_names - @@skip_tables).each do |table_name|
        connection.delete "DELETE FROM #{table_name}", 'Fixture Delete'
      end
    end
  end
end

.tablesObject



17
18
19
# File 'lib/nested_scenarios.rb', line 17

def self.tables
  ActiveRecord::Base.connection.tables - @@skip_tables
end