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

retry_acme_order_service_spec.rb « pages_domains « services « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 601de24e76691f7bd94d282558c297699b6ed9b8 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe PagesDomains::RetryAcmeOrderService do
  let(:domain) { create(:pages_domain, auto_ssl_enabled: true, auto_ssl_failed: true) }

  let(:service) { described_class.new(domain) }

  it 'clears auto_ssl_failed' do
    expect do
      service.execute
    end.to change { domain.auto_ssl_failed }.from(true).to(false)
  end

  it 'schedules renewal worker' do
    expect(PagesDomainSslRenewalWorker).to receive(:perform_async).with(domain.id).and_return(nil).once

    service.execute
  end

  it "doesn't schedule renewal worker if Let's Encrypt integration is not enabled" do
    domain.update!(auto_ssl_enabled: false)

    expect(PagesDomainSslRenewalWorker).not_to receive(:new)

    service.execute
  end

  it "doesn't schedule renewal worker if auto ssl has not failed yet" do
    domain.update!(auto_ssl_failed: false)

    expect(PagesDomainSslRenewalWorker).not_to receive(:new)

    service.execute
  end
end