gitlab-org--gitlab-foss/spec/support/helpers/lets_encrypt_helpers.rb
Vladimir Shushlin 3c33724e2e Add Let's Encrypt client
Part of adding Let's Encrypt certificates for pages domains

Add acme-client gem

Client is being initialized by private key stored in secrets.yml
Let's Encrypt account is being created lazily.
If it's already created, Acme::Client just gets account_kid by
calling new_account method

Make Let's Encrypt client an instance
Wrap order and challenge classes
2019-05-16 09:32:25 +00:00

19 lines
530 B
Ruby

# frozen_string_literal: true
module LetsEncryptHelpers
def stub_lets_encrypt_client
client = instance_double('Acme::Client')
allow(client).to receive(:new_account)
allow(client).to receive(:terms_of_service).and_return(
"https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf"
)
allow(Acme::Client).to receive(:new).with(
private_key: kind_of(OpenSSL::PKey::RSA),
directory: ::Gitlab::LetsEncrypt::Client::STAGING_DIRECTORY_URL
).and_return(client)
client
end
end