Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-30 00:10:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-30 00:10:44 +0300
commitcb37aee9894007e60893693d5d48199ea0f0958f (patch)
tree49cfdd627a74b5f3f94b0a498a39e3be3b38af33 /spec/serializers
parent888564d614552b19b44029f530a67592d66c06fd (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/issue_sidebar_basic_entity_spec.rb32
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