summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Bajao <ebajao@gitlab.com>2019-02-13 19:53:07 +0800
committerPatrick Bajao <ebajao@gitlab.com>2019-02-13 19:53:07 +0800
commit4d689333b850a8f80894899684c3afc4f2abb08f (patch)
tree7d9c58b4231148cbf6e3f53bb1ffc0a511c87dd6
parentc1a63a30b2a601be74ae737064db528123b0e790 (diff)
downloadgitlab-ce-53361-fresh-protected-branches.tar.gz
Fix some errors reported by static analyzer53361-fresh-protected-branches
-rw-r--r--lib/gitlab/user_access.rb2
-rw-r--r--spec/lib/gitlab/user_access_spec.rb2
-rw-r--r--spec/models/protected_branch_spec.rb4
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb
index eef4100dfb2..f837878d8fb 100644
--- a/lib/gitlab/user_access.rb
+++ b/lib/gitlab/user_access.rb
@@ -53,7 +53,7 @@ module Gitlab
return false unless can_access_git?
if protected?(ProtectedBranch, project, ref)
- user.can?(:push_to_create_protected_branch, project) && protected?(ProtectedBranch, project, branch_names_including_rev(newrev))
+ user.can?(:push_to_create_protected_branch, project) && protected?(ProtectedBranch, project, branch_names_including_rev(newrev))
else
user.can?(:push_code, project)
end
diff --git a/spec/lib/gitlab/user_access_spec.rb b/spec/lib/gitlab/user_access_spec.rb
index 6ac7f3a9937..417fae53a91 100644
--- a/spec/lib/gitlab/user_access_spec.rb
+++ b/spec/lib/gitlab/user_access_spec.rb
@@ -284,7 +284,7 @@ describe Gitlab::UserAccess do
context 'create protected branch' do
let(:branch) { create(:protected_branch, project: project, name: 'test') }
- let(:branch_names) { ['test', 'feature'] }
+ let(:branch_names) { %w[test feature] }
before do
allow(project.repository)
diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb
index 89a91e6b1b9..4646396eb3f 100644
--- a/spec/models/protected_branch_spec.rb
+++ b/spec/models/protected_branch_spec.rb
@@ -97,11 +97,11 @@ describe ProtectedBranch do
let(:protected_branch) { build(:protected_branch, name: "master") }
it "returns true when one of the refs matches a protected branch" do
- expect(protected_branch.matches?(["master", "feature"])).to be true
+ expect(protected_branch.matches?(%w[master feature])).to be true
end
it "returns false when none of the refs matches" do
- expect(protected_branch.matches?(["feature", "newbranch"])).to be false
+ expect(protected_branch.matches?(%w[feature newbranch])).to be false
end
end
end