summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-05-13 09:45:34 +0200
committerDouwe Maan <douwe@gitlab.com>2015-05-13 09:46:22 +0200
commitc5e4b443ffdc1c094450d08d29bd96e43376d6d7 (patch)
treef384cef3e0d8204603d3bcde442dc7cdd2414339
parent1981174a1e80533d7a5bc5fd90e06adb67f1dc5d (diff)
downloadgitlab-ce-text-batch-1.tar.gz
Fix GitAccess.text-batch-1
-rw-r--r--lib/gitlab/git_access.rb5
-rw-r--r--spec/lib/gitlab/git_access_spec.rb14
2 files changed, 6 insertions, 13 deletions
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb
index c97249d49e2..c90184d31cf 100644
--- a/lib/gitlab/git_access.rb
+++ b/lib/gitlab/git_access.rb
@@ -136,7 +136,7 @@ module Gitlab
end
unless user.can?(action, project)
- return
+ status =
case action
when :force_push_code_to_protected_branches
build_status_object(false, "You are not allowed to force push code to a protected branch on this project.")
@@ -148,7 +148,8 @@ module Gitlab
build_status_object(false, "You are not allowed to change existing tags on this project.")
else # :push_code
build_status_object(false, "You are not allowed to push code to this project.")
- end
+ end
+ return status
end
build_status_object(true)
diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb
index 39be9d64644..c7291689e32 100644
--- a/spec/lib/gitlab/git_access_spec.rb
+++ b/spec/lib/gitlab/git_access_spec.rb
@@ -115,18 +115,10 @@ describe Gitlab::GitAccess do
let(:actor) { key }
context 'pull code' do
- context 'allowed' do
- before { key.projects << project }
- subject { access.download_access_check }
-
- it { expect(subject.allowed?).to be_truthy }
- end
-
- context 'denied' do
- subject { access.download_access_check }
+ before { key.projects << project }
+ subject { access.download_access_check }
- it { expect(subject.allowed?).to be_falsey }
- end
+ it { expect(subject.allowed?).to be_truthy }
end
end
end