diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2019-05-16 09:32:25 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-05-16 09:32:25 +0000 |
commit | 3c33724e2e182436a2d8b44ef71d0bdac37c585b (patch) | |
tree | ddf7bd94e5981ca34da591afd993cdaa5f45b283 /spec/lib/gitlab/lets_encrypt/challenge_spec.rb | |
parent | c841c8771b8d69034c1ceb6e452746d193865cb0 (diff) | |
download | gitlab-ce-3c33724e2e182436a2d8b44ef71d0bdac37c585b.tar.gz |
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
Diffstat (limited to 'spec/lib/gitlab/lets_encrypt/challenge_spec.rb')
-rw-r--r-- | spec/lib/gitlab/lets_encrypt/challenge_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/lib/gitlab/lets_encrypt/challenge_spec.rb b/spec/lib/gitlab/lets_encrypt/challenge_spec.rb new file mode 100644 index 00000000000..74622f356de --- /dev/null +++ b/spec/lib/gitlab/lets_encrypt/challenge_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe ::Gitlab::LetsEncrypt::Challenge do + delegated_methods = { + url: 'https://example.com/', + status: 'pending', + token: 'tokenvalue', + file_content: 'hereisfilecontent', + request_validation: true + } + + let(:acme_challenge) do + acme_challenge = instance_double('Acme::Client::Resources::Challenge') + allow(acme_challenge).to receive_messages(delegated_methods) + acme_challenge + end + + let(:challenge) { described_class.new(acme_challenge) } + + delegated_methods.each do |method, value| + describe "##{method}" do + it 'delegates to Acme::Client::Resources::Challenge' do + expect(challenge.public_send(method)).to eq(value) + end + end + end +end |