diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/serializers/issue_sidebar_basic_entity_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/serializers/issue_sidebar_basic_entity_spec.rb')
-rw-r--r-- | spec/serializers/issue_sidebar_basic_entity_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/serializers/issue_sidebar_basic_entity_spec.rb b/spec/serializers/issue_sidebar_basic_entity_spec.rb index 716c97f72af..564ffb1aea9 100644 --- a/spec/serializers/issue_sidebar_basic_entity_spec.rb +++ b/spec/serializers/issue_sidebar_basic_entity_spec.rb @@ -94,5 +94,37 @@ RSpec.describe IssueSidebarBasicEntity do expect(entity[:show_crm_contacts]).to be(expected) end end + + context 'in subgroup' do + let(:subgroup_project) { create(:project, :repository, group: subgroup) } + let(:subgroup_issue) { create(:issue, project: subgroup_project) } + let(:serializer) { IssueSerializer.new(current_user: user, project: subgroup_project) } + + subject(:entity) { serializer.represent(subgroup_issue, serializer: 'sidebar') } + + before do + subgroup_project.root_ancestor.add_reporter(user) + end + + context 'with crm enabled' do + let(:subgroup) { create(:group, :crm_enabled, parent: group) } + + it 'is true' do + allow(CustomerRelations::Contact).to receive(:exists_for_group?).with(group).and_return(true) + + expect(entity[:show_crm_contacts]).to be_truthy + end + end + + context 'with crm disabled' do + let(:subgroup) { create(:group, parent: group) } + + it 'is false' do + allow(CustomerRelations::Contact).to receive(:exists_for_group?).with(group).and_return(true) + + expect(entity[:show_crm_contacts]).to be_falsy + end + end + end end end |