diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-30 00:10:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-30 00:10:44 +0300 |
commit | cb37aee9894007e60893693d5d48199ea0f0958f (patch) | |
tree | 49cfdd627a74b5f3f94b0a498a39e3be3b38af33 /spec/policies/issue_policy_spec.rb | |
parent | 888564d614552b19b44029f530a67592d66c06fd (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 | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/spec/policies/issue_policy_spec.rb b/spec/policies/issue_policy_spec.rb index 1fe9e430011..557bda985af 100644 --- a/spec/policies/issue_policy_spec.rb +++ b/spec/policies/issue_policy_spec.rb @@ -397,7 +397,7 @@ RSpec.describe IssuePolicy do end end - describe 'set_issue_crm_contacts' do + describe 'crm permissions' do let(:user) { create(:user) } let(:subgroup) { create(:group, :crm_enabled, parent: create(:group, :crm_enabled)) } let(:project) { create(:project, group: subgroup) } @@ -408,6 +408,7 @@ RSpec.describe IssuePolicy do it 'is disallowed' do project.add_reporter(user) + expect(policies).to be_disallowed(:read_crm_contacts) expect(policies).to be_disallowed(:set_issue_crm_contacts) end end @@ -416,6 +417,7 @@ RSpec.describe IssuePolicy do it 'is allowed' do subgroup.add_reporter(user) + expect(policies).to be_disallowed(:read_crm_contacts) expect(policies).to be_disallowed(:set_issue_crm_contacts) end end @@ -424,8 +426,31 @@ RSpec.describe IssuePolicy do it 'is allowed' do subgroup.parent.add_reporter(user) + expect(policies).to be_allowed(:read_crm_contacts) expect(policies).to be_allowed(:set_issue_crm_contacts) end end + + context 'when crm disabled on subgroup' do + let(:subgroup) { create(:group, parent: create(:group, :crm_enabled)) } + + it 'is disallowed' do + subgroup.parent.add_reporter(user) + + expect(policies).to be_disallowed(:read_crm_contacts) + expect(policies).to be_disallowed(:set_issue_crm_contacts) + end + end + + context 'when peronsal namespace' do + let(:project) { create(:project) } + + it 'is disallowed' do + project.add_reporter(user) + + expect(policies).to be_disallowed(:read_crm_contacts) + expect(policies).to be_disallowed(:set_issue_crm_contacts) + end + end end end |