diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-11 18:08:58 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-11 18:08:58 +0000 |
commit | 1ca9950d5f890cd8f185e1eda158b969a7244fe2 (patch) | |
tree | 6f62715938a4b2b001705c51c697609a8e0850ae /spec/support/shared_examples | |
parent | bcc77054ee9aefd1e332e04a4189390fd5a3112e (diff) | |
download | gitlab-ce-1ca9950d5f890cd8f185e1eda158b969a7244fe2.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r-- | spec/support/shared_examples/workers/pages_domain_cron_worker_shared_examples.rb | 21 |
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 |