2019-07-25 01:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-02-26 11:55:34 -05:00
|
|
|
module DbCleaner
|
2020-01-31 04:08:53 -05:00
|
|
|
def delete_from_all_tables!(except: [])
|
|
|
|
except << 'ar_internal_metadata'
|
|
|
|
|
2019-04-26 11:49:19 -04:00
|
|
|
DatabaseCleaner.clean_with(:deletion, cache_tables: false, except: except)
|
|
|
|
end
|
|
|
|
|
2019-02-26 11:55:34 -05:00
|
|
|
def deletion_except_tables
|
|
|
|
[]
|
2014-06-07 04:09:56 -04:00
|
|
|
end
|
|
|
|
|
2019-02-26 11:55:34 -05:00
|
|
|
def setup_database_cleaner
|
|
|
|
DatabaseCleaner[:active_record, { connection: ActiveRecord::Base }]
|
2012-08-23 05:19:40 -04:00
|
|
|
end
|
|
|
|
end
|
2019-09-13 09:26:31 -04:00
|
|
|
|
|
|
|
DbCleaner.prepend_if_ee('EE::DbCleaner')
|