diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-30 00:09:23 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-30 00:09:23 +0300 |
commit | ab593c8ded443f7ade3540ff8dac69ee51bc74fd (patch) | |
tree | 1fb8b2e194747f135d8610cd4b77766ac458b3a7 /spec/policies/issue_policy_spec.rb | |
parent | 860efb35e24e07a1a22bcafcddb5f0409d40354c (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 | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/policies/issue_policy_spec.rb b/spec/policies/issue_policy_spec.rb index 557bda985af..fefbb59a830 100644 --- a/spec/policies/issue_policy_spec.rb +++ b/spec/policies/issue_policy_spec.rb @@ -13,6 +13,7 @@ RSpec.describe IssuePolicy do let(:reporter_from_group_link) { create(:user) } let(:non_member) { create(:user) } let(:support_bot) { User.support_bot } + let(:alert_bot) { User.alert_bot } def permissions(user, issue) described_class.new(user, issue) @@ -41,6 +42,14 @@ RSpec.describe IssuePolicy do end end + shared_examples 'alert bot' do + it 'allows alert_bot to read and set metadata on issues' do + expect(permissions(alert_bot, issue)).to be_allowed(:read_issue, :read_issue_iid, :update_issue, :admin_issue, :set_issue_metadata, :set_confidentiality) + expect(permissions(alert_bot, issue_no_assignee)).to be_allowed(:read_issue, :read_issue_iid, :update_issue, :admin_issue, :set_issue_metadata, :set_confidentiality) + expect(permissions(alert_bot, new_issue)).to be_allowed(:read_issue, :read_issue_iid, :update_issue, :admin_issue, :set_issue_metadata, :set_confidentiality) + end + end + context 'a private project' do let(:project) { create(:project, :private) } let(:issue) { create(:issue, project: project, assignees: [assignee], author: author) } @@ -106,6 +115,7 @@ RSpec.describe IssuePolicy do expect(permissions(non_member, new_issue)).to be_disallowed(:create_issue, :set_issue_metadata, :set_confidentiality) end + it_behaves_like 'alert bot' it_behaves_like 'support bot with service desk disabled' it_behaves_like 'support bot with service desk enabled' @@ -270,6 +280,7 @@ RSpec.describe IssuePolicy do expect(permissions(support_bot, new_issue)).to be_disallowed(:create_issue, :set_issue_metadata, :set_confidentiality) end + it_behaves_like 'alert bot' it_behaves_like 'support bot with service desk enabled' context 'when issues are private' do @@ -326,6 +337,7 @@ RSpec.describe IssuePolicy do expect(permissions(non_member, new_issue)).to be_disallowed(:create_issue, :set_issue_metadata, :set_confidentiality) end + it_behaves_like 'alert bot' it_behaves_like 'support bot with service desk disabled' it_behaves_like 'support bot with service desk enabled' end |