diff options
-rw-r--r-- | lib/gitlab/user_access.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/user_access_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/protected_branch_spec.rb | 4 |
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 |