Class: NestedScenarios

Inherits:
Object show all
Defined in:
lib/nested_scenarios/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/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

.load_root_fixturesObject



25
26
27
# File 'lib/nested_scenarios/nested_scenarios.rb', line 25

def self.load_root_fixtures
  Test::Unit::TestCase.load_root_fixtures
end

.load_root_fixtures=(value) ⇒ Object



21
22
23
# File 'lib/nested_scenarios/nested_scenarios.rb', line 21

def self.load_root_fixtures=(value)
  Test::Unit::TestCase.load_root_fixtures = value
end

.tablesObject



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

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