Welcome to mirror list, hosted at ThFree Co, Russian Federation.

pages_domain_verification_worker_spec.rb « workers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2f23dcb487fd999dc1f8d009032de71e68da0f96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

require 'spec_helper'

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

  let(:domain) { create(:pages_domain) }

  describe '#perform' do
    it 'does nothing for a non-existent domain' do
      domain.destroy

      expect(VerifyPagesDomainService).not_to receive(:new)

      expect { worker.perform(domain.id) }.not_to raise_error
    end

    it 'delegates to VerifyPagesDomainService' do
      service = double(:service)
      expected_domain = satisfy { |obj| obj == domain }

      expect(VerifyPagesDomainService).to receive(:new).with(expected_domain) { service }
      expect(service).to receive(:execute)

      worker.perform(domain.id)
    end
  end
end