summaryrefslogtreecommitdiff
path: root/spec/workers/pages_domain_verification_cron_worker_spec.rb
blob: 8f780428c82be75539d96e19b0739ad2d8fc6098 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'spec_helper'

describe PagesDomainVerificationCronWorker do
  subject(:worker) { described_class.new }

  describe '#perform' do
    it 'enqueues a PagesDomainVerificationWorker for domains needing verification' do
      verified = create(:pages_domain)
      reverify = create(:pages_domain, :reverify)
      disabled = create(:pages_domain, :disabled)

      [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