mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-28 11:46:10 +01:00
20 lines
No EOL
488 B
Ruby
20 lines
No EOL
488 B
Ruby
module Scenarios
|
|
module TableBlasting
|
|
def self.included(base)
|
|
base.module_eval do
|
|
delegate :blasted_tables, :to => :table_config
|
|
end
|
|
end
|
|
|
|
def blast_table(name) # :nodoc:
|
|
ActiveRecord::Base.silence do
|
|
ActiveRecord::Base.connection.delete "DELETE FROM #{name}", "Scenario Delete"
|
|
end
|
|
blasted_tables << name
|
|
end
|
|
|
|
def prepare_table(name)
|
|
blast_table(name) unless blasted_tables.include?(name)
|
|
end
|
|
end
|
|
end |