Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-01-04 04:02:30 +0300
committerGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-01-04 19:48:10 +0300
commitd92d93087070d1dc80efb284abcb2688b918626d (patch)
tree4c7b7fbf1ecb8e09ffec80957d8f7acb168a952c /spec
parent4d0c547e7d365377948c7404b7fcef38fb7987bf (diff)
Merge branch 'sh-fix-clone-url-for-https' into 'master'
Fix clone URL not showing if protocol is HTTPS Closes #55896 See merge request gitlab-org/gitlab-ce!24131 (cherry picked from commit 64c582d1841a35193c684a707b9688feb2d21772) 913084e6 Fix clone URL not showing if protocol is HTTPS
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