blob: daaa939ecfe82d2f14a43cf870a966e798722d7e (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe PagesDomainSslRenewalWorker, feature_category: :pages do
include LetsEncryptHelpers
subject(:worker) { described_class.new }
let(:project) { create(:project) }
let(:domain) { create(:pages_domain, project: project) }
before do
stub_lets_encrypt_settings
end
describe '#perform' do
it 'delegates to ObtainLetsEncryptCertificateService' do
service = double(:service)
expect(::PagesDomains::ObtainLetsEncryptCertificateService).to receive(:new).with(domain).and_return(service)
expect(service).to receive(:execute)
worker.perform(domain.id)
end
shared_examples 'does nothing' do
it 'does nothing' do
expect(::PagesDomains::ObtainLetsEncryptCertificateService).not_to receive(:new)
worker.perform(domain.id)
end
end
context 'when domain was deleted' do
before do
domain.destroy!
end
include_examples 'does nothing'
end
context 'when domain is disabled' do
let(:domain) { create(:pages_domain, :disabled) }
include_examples 'does nothing'
end
end
end
|