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-02-11 21:08:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-11 21:08:58 +0300
commit1ca9950d5f890cd8f185e1eda158b969a7244fe2 (patch)
tree6f62715938a4b2b001705c51c697609a8e0850ae /spec/support/shared_examples/workers
parentbcc77054ee9aefd1e332e04a4189390fd5a3112e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples/workers')
-rw-r--r--spec/support/shared_examples/workers/pages_domain_cron_worker_shared_examples.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/support/shared_examples/workers/pages_domain_cron_worker_shared_examples.rb b/spec/support/shared_examples/workers/pages_domain_cron_worker_shared_examples.rb
new file mode 100644
index 00000000000..9e8102aea53
--- /dev/null
+++ b/spec/support/shared_examples/workers/pages_domain_cron_worker_shared_examples.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+RSpec.shared_examples 'a pages cronjob scheduling jobs with context' do |scheduled_worker_class|
+ let(:worker) { described_class.new }
+
+ it 'does not cause extra queries for multiple domains' do
+ control = ActiveRecord::QueryRecorder.new { worker.perform }
+
+ extra_domain
+
+ expect { worker.perform }.not_to exceed_query_limit(control)
+ end
+
+ it 'schedules the renewal with a context' do
+ extra_domain
+
+ worker.perform
+
+ expect(scheduled_worker_class.jobs.last).to include("meta.project" => extra_domain.project.full_path)
+ end
+end