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
diff options
context:
space:
mode:
authorAndrew Smith <espadav8@gmail.com>2016-12-01 16:11:29 +0300
committerAndrew Smith <espadav8@gmail.com>2016-12-02 15:33:55 +0300
commita527fab1f5d565c804bd5de5300dfcbb88376f8d (patch)
tree400d0c34e390ed4034e284771b5106a32ef65837 /spec/models/user_spec.rb
parent532f8cbd38d61ba73886ea3ed0dbce1864819bec (diff)
Test all values for `enabled_git_access_protocol`
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r--spec/models/user_spec.rb23
1 files changed, 14 insertions, 9 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 475f4419d58..2244803f90c 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -576,15 +576,20 @@ describe User, models: true do
end
end
- context 'when current_application_settings.enabled_git_access_protocol does not contain SSH' do
- before do
- stub_application_setting(enabled_git_access_protocol: 'HTTP')
- end
-
- it "doesn't require user to have SSH key" do
- user = build(:user)
-
- expect(user.require_ssh_key?).to be_falsey
+ describe '#require_ssh_key?' do
+ protocol_and_expectation = {
+ 'http' => false,
+ 'ssh' => true,
+ '' => true,
+ }
+
+ protocol_and_expectation.each do |protocol, expected|
+ it "has correct require_ssh_key?" do
+ stub_application_setting(enabled_git_access_protocol: protocol)
+ user = build(:user)
+
+ expect(user.require_ssh_key?).to eq(expected)
+ end
end
end
end