Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-15 18:42:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-15 18:42:17 +0300
commit44fdf983bd35328dd577d3d3650d14163ef3e2b6 (patch)
tree84ff300d056cfbabb5a0fe2a9cbaa80aaeab1cc5 /spec/migrations
parentbc9fa07b26184b5c94808f704db6ea1ac81bf4de (diff)
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'spec/migrations')
-rw-r--r--spec/migrations/schedule_backfill_push_rules_id_in_projects_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/migrations/schedule_backfill_push_rules_id_in_projects_spec.rb b/spec/migrations/schedule_backfill_push_rules_id_in_projects_spec.rb
new file mode 100644
index 00000000000..77648f5c64a
--- /dev/null
+++ b/spec/migrations/schedule_backfill_push_rules_id_in_projects_spec.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+require Rails.root.join('db', 'post_migrate', '20200325162730_schedule_backfill_push_rules_id_in_projects.rb')
+
+describe ScheduleBackfillPushRulesIdInProjects do
+ let(:push_rules) { table(:push_rules) }
+
+ it 'adds global rule association to application settings' do
+ application_settings = table(:application_settings)
+ setting = application_settings.create!
+ sample_rule = push_rules.create!(is_sample: true)
+
+ Sidekiq::Testing.fake! do
+ disable_migrations_output { migrate! }
+ end
+
+ setting.reload
+ expect(setting.push_rule_id).to eq(sample_rule.id)
+ end
+
+ it 'schedules worker to migrate project push rules' do
+ rule_1 = push_rules.create!
+ rule_2 = push_rules.create!
+
+ Sidekiq::Testing.fake! do
+ disable_migrations_output { migrate! }
+
+ expect(BackgroundMigrationWorker.jobs.size).to eq(1)
+ expect(described_class::MIGRATION)
+ .to be_scheduled_delayed_migration(5.minutes, rule_1.id, rule_2.id)
+ end
+ end
+end