diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /spec/finders/issues_finder_spec.rb | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'spec/finders/issues_finder_spec.rb')
-rw-r--r-- | spec/finders/issues_finder_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb index 9f12308013e..31563a6326d 100644 --- a/spec/finders/issues_finder_spec.rb +++ b/spec/finders/issues_finder_spec.rb @@ -910,6 +910,45 @@ RSpec.describe IssuesFinder do end end + context 'filtering by crm contact' do + let_it_be(:contact1) { create(:contact, group: group) } + let_it_be(:contact2) { create(:contact, group: group) } + + let_it_be(:contact1_issue1) { create(:issue, project: project1) } + let_it_be(:contact1_issue2) { create(:issue, project: project1) } + let_it_be(:contact2_issue1) { create(:issue, project: project1) } + + let(:params) { { crm_contact_id: contact1.id } } + + it 'returns for that contact' do + create(:issue_customer_relations_contact, issue: contact1_issue1, contact: contact1) + create(:issue_customer_relations_contact, issue: contact1_issue2, contact: contact1) + create(:issue_customer_relations_contact, issue: contact2_issue1, contact: contact2) + + expect(issues).to contain_exactly(contact1_issue1, contact1_issue2) + end + end + + context 'filtering by crm organization' do + let_it_be(:organization) { create(:organization, group: group) } + let_it_be(:contact1) { create(:contact, group: group, organization: organization) } + let_it_be(:contact2) { create(:contact, group: group, organization: organization) } + + let_it_be(:contact1_issue1) { create(:issue, project: project1) } + let_it_be(:contact1_issue2) { create(:issue, project: project1) } + let_it_be(:contact2_issue1) { create(:issue, project: project1) } + + let(:params) { { crm_organization_id: organization.id } } + + it 'returns for that contact' do + create(:issue_customer_relations_contact, issue: contact1_issue1, contact: contact1) + create(:issue_customer_relations_contact, issue: contact1_issue2, contact: contact1) + create(:issue_customer_relations_contact, issue: contact2_issue1, contact: contact2) + + expect(issues).to contain_exactly(contact1_issue1, contact1_issue2, contact2_issue1) + end + end + context 'when the user is unauthorized' do let(:search_user) { nil } |