2020-02-05 16:09:02 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
# The :each scope runs "inside" the example, so this hook ensures the DB is in the
|
|
|
|
# correct state before any examples' before hooks are called. This prevents a
|
|
|
|
# problem where `ScheduleIssuesClosedAtTypeChange` (or any migration that depends
|
|
|
|
# on background migrations being run inline during test setup) can be broken by
|
|
|
|
# altering Sidekiq behavior in an unrelated spec like so:
|
|
|
|
#
|
|
|
|
# around do |example|
|
|
|
|
# Sidekiq::Testing.fake! do
|
|
|
|
# example.run
|
|
|
|
# end
|
|
|
|
# end
|
|
|
|
config.before(:context, :migration) do
|
|
|
|
schema_migrate_down!
|
|
|
|
end
|
|
|
|
|
|
|
|
# Each example may call `migrate!`, so we must ensure we are migrated down every time
|
|
|
|
config.before(:each, :migration) do
|
|
|
|
use_fake_application_settings
|
2022-10-24 11:11:29 -04:00
|
|
|
|
|
|
|
schema_migrate_down!
|
2020-02-05 16:09:02 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
config.after(:context, :migration) do
|
|
|
|
Gitlab::CurrentSettings.clear_in_memory_application_settings!
|
|
|
|
end
|
|
|
|
end
|