diff options
author | Vladimir Shushlin <v.shushlin@gmail.com> | 2019-06-13 14:37:45 +0300 |
---|---|---|
committer | Vladimir Shushlin <v.shushlin@gmail.com> | 2019-06-25 11:30:12 +0300 |
commit | 432f2bbc9cf64d53418c1eb9bb701254803a0e1e (patch) | |
tree | 6f93c0b6ecafcdcf7ca7f76d48b7a5afa2319204 /spec/lib/gitlab/lets_encrypt_spec.rb | |
parent | 3115c9fc121743dea29aa92a603a0c782eb3d75b (diff) |
Use project depended feature flag for pages ssl
Also add ::Gitlab::LetsEncrypt.enabled? shortcut
and simplify it a lot
Diffstat (limited to 'spec/lib/gitlab/lets_encrypt_spec.rb')
-rw-r--r-- | spec/lib/gitlab/lets_encrypt_spec.rb | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/lib/gitlab/lets_encrypt_spec.rb b/spec/lib/gitlab/lets_encrypt_spec.rb new file mode 100644 index 00000000000..674b114e9d3 --- /dev/null +++ b/spec/lib/gitlab/lets_encrypt_spec.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe ::Gitlab::LetsEncrypt do + include LetsEncryptHelpers + + before do + stub_lets_encrypt_settings + end + + describe '.enabled?' do + let(:project) { create(:project) } + let(:pages_domain) { create(:pages_domain, project: project) } + + subject { described_class.enabled?(pages_domain) } + + context 'when terms of service are accepted' do + it { is_expected.to eq(true) } + + context 'when feature flag is disabled' do + before do + stub_feature_flags(pages_auto_ssl: false) + end + + it { is_expected.to eq(false) } + end + end + + context 'when terms of service are not accepted' do + before do + stub_application_setting(lets_encrypt_terms_of_service_accepted: false) + end + + it { is_expected.to eq(false) } + end + + context 'when feature flag for project is disabled' do + before do + stub_feature_flags(pages_auto_ssl_for_project: false) + end + + it 'returns false' do + is_expected.to eq(false) + end + end + + context 'when domain has not project' do + let(:pages_domain) { create(:pages_domain) } + + it 'returns false' do + is_expected.to eq(false) + end + end + end +end |