debian-mirror-gitlab/spec/workers/pages_domain_verification_cron_worker_spec.rb

31 lines
942 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
require 'spec_helper'
describe PagesDomainVerificationCronWorker do
subject(:worker) { described_class.new }
describe '#perform' do
2019-07-31 22:56:46 +05:30
let!(:verified) { create(:pages_domain) }
let!(:reverify) { create(:pages_domain, :reverify) }
let!(:disabled) { create(:pages_domain, :disabled) }
2018-03-17 18:26:18 +05:30
2019-09-04 21:01:54 +05:30
it 'does nothing if the database is read-only' do
allow(Gitlab::Database).to receive(:read_only?).and_return(true)
expect(PagesDomainVerificationWorker).not_to receive(:perform_async).with(reverify.id)
worker.perform
end
2019-07-31 22:56:46 +05:30
it 'enqueues a PagesDomainVerificationWorker for domains needing verification' do
2018-03-17 18:26:18 +05:30
[reverify, disabled].each do |domain|
expect(PagesDomainVerificationWorker).to receive(:perform_async).with(domain.id)
end
expect(PagesDomainVerificationWorker).not_to receive(:perform_async).with(verified.id)
worker.perform
end
end
end