2019-02-26 11:55:34 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require_relative 'db_cleaner'
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
include DbCleaner
|
|
|
|
|
|
|
|
# Ensure all sequences are reset at the start of the suite run
|
|
|
|
config.before(:suite) do
|
|
|
|
setup_database_cleaner
|
|
|
|
DatabaseCleaner.clean_with(:truncation)
|
|
|
|
end
|
|
|
|
|
|
|
|
config.append_after(:context) do
|
2019-04-26 11:49:19 -04:00
|
|
|
delete_from_all_tables!
|
2019-02-26 11:55:34 -05:00
|
|
|
end
|
|
|
|
|
2019-04-26 11:49:19 -04:00
|
|
|
config.around(:each, :delete) do |example|
|
|
|
|
self.class.use_transactional_tests = false
|
2019-02-26 11:55:34 -05:00
|
|
|
|
2019-04-26 11:49:19 -04:00
|
|
|
example.run
|
2019-02-26 11:55:34 -05:00
|
|
|
|
2019-04-26 11:49:19 -04:00
|
|
|
delete_from_all_tables!(except: deletion_except_tables)
|
2019-02-26 11:55:34 -05:00
|
|
|
end
|
|
|
|
|
2019-04-26 11:49:19 -04:00
|
|
|
config.around(:each, :migration) do |example|
|
|
|
|
self.class.use_transactional_tests = false
|
2019-02-26 11:55:34 -05:00
|
|
|
|
2019-04-26 11:49:19 -04:00
|
|
|
example.run
|
2019-02-26 11:55:34 -05:00
|
|
|
|
2019-04-26 11:49:19 -04:00
|
|
|
delete_from_all_tables!
|
2019-02-26 11:55:34 -05:00
|
|
|
end
|
|
|
|
end
|