Commit 3219afff authored by Michael Kozono's avatar Michael Kozono

Make :migration specs a little more robust

E.g. https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/52873034
parent 293c51e3
......@@ -154,6 +154,22 @@ RSpec.configure do |config|
Sidekiq.redis(&:flushall)
end
# 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
schema_migrate_down!
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment