diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-10 06:06:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-10 06:06:28 +0300 |
commit | ee97c0d1a2dd452829d2cf6ec150045536bd74d5 (patch) | |
tree | 95d2551999b44d70842e156877d1d71145baba9f | |
parent | 308146dc398fd4c13453048105498018459e0985 (diff) |
Add latest changes from gitlab-org/gitlab@master
-rw-r--r-- | changelogs/unreleased/33230-undefined-method-terms_of_service_url.yml | 5 | ||||
-rw-r--r-- | lib/gitlab/lets_encrypt.rb | 4 | ||||
-rw-r--r-- | spec/controllers/admin/application_settings_controller_spec.rb | 18 | ||||
-rw-r--r-- | spec/lib/gitlab/lets_encrypt_spec.rb | 12 |
4 files changed, 39 insertions, 0 deletions
diff --git a/changelogs/unreleased/33230-undefined-method-terms_of_service_url.yml b/changelogs/unreleased/33230-undefined-method-terms_of_service_url.yml new file mode 100644 index 00000000000..547612ccf39 --- /dev/null +++ b/changelogs/unreleased/33230-undefined-method-terms_of_service_url.yml @@ -0,0 +1,5 @@ +--- +title: Fix 500 error on clicking to LetsEncrypt Terms of Service +merge_request: 18263 +author: +type: fixed diff --git a/lib/gitlab/lets_encrypt.rb b/lib/gitlab/lets_encrypt.rb index 08ad2ab91b0..9d14b151f7d 100644 --- a/lib/gitlab/lets_encrypt.rb +++ b/lib/gitlab/lets_encrypt.rb @@ -5,5 +5,9 @@ module Gitlab def self.enabled? Gitlab::CurrentSettings.lets_encrypt_terms_of_service_accepted end + + def self.terms_of_service_url + ::Gitlab::LetsEncrypt::Client.new.terms_of_service_url + end end end diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb index 8bb77576d26..bc14e9112a1 100644 --- a/spec/controllers/admin/application_settings_controller_spec.rb +++ b/spec/controllers/admin/application_settings_controller_spec.rb @@ -143,4 +143,22 @@ describe Admin::ApplicationSettingsController do expect(response).to redirect_to(admin_runners_path) end end + + describe 'GET #lets_encrypt_terms_of_service' do + include LetsEncryptHelpers + + before do + sign_in(admin) + + stub_lets_encrypt_client + end + + subject { get :lets_encrypt_terms_of_service } + + it 'redirects the user to the terms of service page' do + subject + + expect(response).to redirect_to("https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf") + end + end end diff --git a/spec/lib/gitlab/lets_encrypt_spec.rb b/spec/lib/gitlab/lets_encrypt_spec.rb index 65aea0937f1..2229393fb32 100644 --- a/spec/lib/gitlab/lets_encrypt_spec.rb +++ b/spec/lib/gitlab/lets_encrypt_spec.rb @@ -24,4 +24,16 @@ describe ::Gitlab::LetsEncrypt do it { is_expected.to eq(false) } end end + + describe '.terms_of_service_url' do + before do + stub_lets_encrypt_client + end + + subject { described_class.terms_of_service_url } + + it 'returns the url' do + is_expected.to eq("https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf") + end + end end |