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.rb28
1 files changed, 26 insertions, 2 deletions
diff --git a/spec/serializers/issue_sidebar_basic_entity_spec.rb b/spec/serializers/issue_sidebar_basic_entity_spec.rb
index da07290f349..716c97f72af 100644
--- a/spec/serializers/issue_sidebar_basic_entity_spec.rb
+++ b/spec/serializers/issue_sidebar_basic_entity_spec.rb
@@ -3,9 +3,10 @@
require 'spec_helper'
RSpec.describe IssueSidebarBasicEntity do
- let_it_be(:project) { create(:project, :repository) }
+ let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:project) { create(:project, :repository, group: group) }
let_it_be(:user) { create(:user, developer_projects: [project]) }
- let_it_be(:issue) { create(:issue, project: project, assignees: [user]) }
+ let_it_be_with_reload(:issue) { create(:issue, project: project, assignees: [user]) }
let(:serializer) { IssueSerializer.new(current_user: user, project: project) }
@@ -71,4 +72,27 @@ RSpec.describe IssueSidebarBasicEntity do
end
end
end
+
+ describe 'show_crm_contacts' do
+ using RSpec::Parameterized::TableSyntax
+
+ where(:is_reporter, :contacts_exist_for_group, :expected) do
+ false | false | false
+ false | true | false
+ true | false | false
+ true | true | true
+ end
+
+ with_them do
+ it 'sets proper boolean value for show_crm_contacts' do
+ allow(CustomerRelations::Contact).to receive(:exists_for_group?).with(group).and_return(contacts_exist_for_group)
+
+ if is_reporter
+ project.root_ancestor.add_reporter(user)
+ end
+
+ expect(entity[:show_crm_contacts]).to be(expected)
+ end
+ end
+ end
end