diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-06 00:09:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-06 00:09:02 +0300 |
commit | 76623c12c136f43f24c3966ed4b469e2c0b434b7 (patch) | |
tree | 7c5ec884c25e03e4fea131a4d112a9d0ccfd59b8 /spec/support/migration.rb | |
parent | b042382bbf5a4977c5b5c6b0a9a33f4e8ca8d16d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/migration.rb')
-rw-r--r-- | spec/support/migration.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/support/migration.rb b/spec/support/migration.rb new file mode 100644 index 00000000000..3c359af886d --- /dev/null +++ b/spec/support/migration.rb @@ -0,0 +1,31 @@ +# 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 + + schema_migrate_down! + end + + config.after(:context, :migration) do + schema_migrate_up! + + Gitlab::CurrentSettings.clear_in_memory_application_settings! + end +end |