2020-03-13 15:44:24 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.shared_examples 'a pages cronjob scheduling jobs with context' do |scheduled_worker_class|
|
|
|
|
let(:worker) { described_class.new }
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
context 'with RequestStore enabled', :request_store do
|
|
|
|
it 'does not cause extra queries for multiple domains' do
|
|
|
|
control = ActiveRecord::QueryRecorder.new { worker.perform }
|
2020-03-13 15:44:24 +05:30
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
extra_domain
|
2020-03-13 15:44:24 +05:30
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
expect { worker.perform }.not_to exceed_query_limit(control)
|
|
|
|
end
|
2020-03-13 15:44:24 +05:30
|
|
|
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
|