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:
Diffstat (limited to 'spec/serializers/issue_sidebar_basic_entity_spec.rb')
-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