diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-30 15:12:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-30 15:12:25 +0300 |
commit | 60273ebb302dabd6e724e4b7baf9ed7b39de5c09 (patch) | |
tree | 094133ffdc73d53c56e9779cfeb4f3a548d255c3 /spec/policies/protected_branch_policy_spec.rb | |
parent | 0c918eb567a29de7ecfc890e8e2dd90e900e7e58 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/policies/protected_branch_policy_spec.rb')
-rw-r--r-- | spec/policies/protected_branch_policy_spec.rb | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/spec/policies/protected_branch_policy_spec.rb b/spec/policies/protected_branch_policy_spec.rb index bb6dbff18a0..d676de14735 100644 --- a/spec/policies/protected_branch_policy_spec.rb +++ b/spec/policies/protected_branch_policy_spec.rb @@ -10,15 +10,47 @@ RSpec.describe ProtectedBranchPolicy do subject { described_class.new(user, protected_branch) } - it 'branches can be updated via project maintainers' do - project.add_maintainer(user) + context 'as maintainers' do + before do + project.add_maintainer(user) + end - is_expected.to be_allowed(:update_protected_branch) + it 'can be read' do + is_expected.to be_allowed(:read_protected_branch) + end + + it 'can be created' do + is_expected.to be_allowed(:create_protected_branch) + end + + it 'can be updated' do + is_expected.to be_allowed(:update_protected_branch) + end + + it 'can be destroyed' do + is_expected.to be_allowed(:destroy_protected_branch) + end end - it "branches can't be updated by guests" do - project.add_guest(user) + context 'as guests' do + before do + project.add_guest(user) + end + + it 'can be read' do + is_expected.to be_disallowed(:read_protected_branch) + end + + it 'can be created' do + is_expected.to be_disallowed(:create_protected_branch) + end + + it 'can be updated' do + is_expected.to be_disallowed(:update_protected_branch) + end - is_expected.to be_disallowed(:update_protected_branch) + it 'cannot be destroyed' do + is_expected.to be_disallowed(:destroy_protected_branch) + end end end |