diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-15 18:08:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-15 18:08:04 +0300 |
commit | c4c1fc5fe7c756fc6f8f79eb1624b1bbe4fe2d69 (patch) | |
tree | 8c95e39fc4956cdd9178c46ea85cbeeeac3bc360 /spec/policies/issue_policy_spec.rb | |
parent | 927df95cc4453bdacbc59960df32008b02c4e28a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/policies/issue_policy_spec.rb')
-rw-r--r-- | spec/policies/issue_policy_spec.rb | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/spec/policies/issue_policy_spec.rb b/spec/policies/issue_policy_spec.rb index 242a002bc23..9d52079e4be 100644 --- a/spec/policies/issue_policy_spec.rb +++ b/spec/policies/issue_policy_spec.rb @@ -206,11 +206,25 @@ describe IssuePolicy do it 'allows guests to comment' do expect(permissions(guest, issue)).to be_allowed(:create_note) end - it 'allows admins to view' do - expect(permissions(admin, issue)).to be_allowed(:read_issue) + + context 'when admin mode is enabled', :enable_admin_mode do + it 'allows admins to view' do + expect(permissions(admin, issue)).to be_allowed(:read_issue) + end + + it 'allows admins to comment' do + expect(permissions(admin, issue)).to be_allowed(:create_note) + end end - it 'allows admins to comment' do - expect(permissions(admin, issue)).to be_allowed(:create_note) + + context 'when admin mode is disabled' do + it 'forbids admins to view' do + expect(permissions(admin, issue)).to be_disallowed(:read_issue) + end + + it 'forbids admins to comment' do + expect(permissions(admin, issue)).to be_disallowed(:create_note) + end end end |