summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-01-03 13:17:44 -0800
committerStan Hu <stanhu@gmail.com>2019-01-03 13:41:39 -0800
commit913084e6a3147fb55e66fc38b230f1166b7e9f8b (patch)
tree7838412b75be6d9a2ab4396a21796287fe8e6a48 /spec
parent0e20c8eb8b71eaa71fbfd5dedf6ccd6492531e14 (diff)
downloadgitlab-ce-913084e6a3147fb55e66fc38b230f1166b7e9f8b.tar.gz
Fix clone URL not showing if protocol is HTTPSsh-fix-clone-url-for-https
GitLab 11.6.2 fixed the case for HTTP. However, HTTPS still did not work because the protocol returned to `http_enabled?` was the actual protocol in use (e.g. `https` instead of `http`). Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/55896
Diffstat (limited to 'spec')
-rw-r--r--spec/helpers/application_settings_helper_spec.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/helpers/application_settings_helper_spec.rb b/spec/helpers/application_settings_helper_spec.rb
new file mode 100644
index 00000000000..705523f1110
--- /dev/null
+++ b/spec/helpers/application_settings_helper_spec.rb
@@ -0,0 +1,39 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe ApplicationSettingsHelper do
+ context 'when all protocols in use' do
+ before do
+ stub_application_setting(enabled_git_access_protocol: '')
+ end
+
+ it { expect(all_protocols_enabled?).to be_truthy }
+ it { expect(http_enabled?).to be_truthy }
+ it { expect(ssh_enabled?).to be_truthy }
+ end
+
+ context 'when SSH is only in use' do
+ before do
+ stub_application_setting(enabled_git_access_protocol: 'ssh')
+ end
+
+ it { expect(all_protocols_enabled?).to be_falsey }
+ it { expect(http_enabled?).to be_falsey }
+ it { expect(ssh_enabled?).to be_truthy }
+ end
+
+ shared_examples 'when HTTP protocol is in use' do |protocol|
+ before do
+ allow(Gitlab.config.gitlab).to receive(:protocol).and_return(protocol)
+ stub_application_setting(enabled_git_access_protocol: 'http')
+ end
+
+ it { expect(all_protocols_enabled?).to be_falsey }
+ it { expect(http_enabled?).to be_truthy }
+ it { expect(ssh_enabled?).to be_falsey }
+ end
+
+ it_behaves_like 'when HTTP protocol is in use', 'https'
+ it_behaves_like 'when HTTP protocol is in use', 'http'
+end