Class: TestData::TruncatesTestData
- Inherits:
-
Object
- Object
- TestData::TruncatesTestData
- Defined in:
- lib/test_data/truncates_test_data.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize ⇒ TruncatesTestData
constructor
A new instance of TruncatesTestData.
Constructor Details
#initialize ⇒ TruncatesTestData
Returns a new instance of TruncatesTestData.
3 4 5 6 |
# File 'lib/test_data/truncates_test_data.rb', line 3 def initialize @config = TestData.config @statistics = TestData.statistics end |
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 |
# File 'lib/test_data/truncates_test_data.rb', line 8 def call connection.disable_referential_integrity do connection.execute("TRUNCATE TABLE #{tables_to_truncate.map { |t| connection.quote_table_name(t) }.join(", ")} #{"CASCADE" unless @config.truncate_these_test_data_tables.present?}") end @statistics.count_truncate! end |