diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-09 12:12:04 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-09 12:12:04 +0000 |
commit | 399b67163d310261425c6c1b35adfbf606b77a86 (patch) | |
tree | f2ea08327a08db558708e935e9dc5c6be8e39967 /spec/services/issues | |
parent | 7c2cf0604b6b51dae1773accb687cccabd657f44 (diff) | |
download | gitlab-ce-399b67163d310261425c6c1b35adfbf606b77a86.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/issues')
-rw-r--r-- | spec/services/issues/move_service_spec.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/services/issues/move_service_spec.rb b/spec/services/issues/move_service_spec.rb index ef501f47f0d..35a380e01d0 100644 --- a/spec/services/issues/move_service_spec.rb +++ b/spec/services/issues/move_service_spec.rb @@ -168,6 +168,48 @@ RSpec.describe Issues::MoveService do end end + context 'issue with contacts' do + let_it_be(:contacts) { create_list(:contact, 2, group: group) } + + before do + old_issue.customer_relations_contacts = contacts + end + + it 'preserves contacts' do + new_issue = move_service.execute(old_issue, new_project) + + expect(new_issue.customer_relations_contacts).to eq(contacts) + end + + context 'when moving to another root group' do + let(:another_project) { create(:project, namespace: create(:group)) } + + before do + another_project.add_reporter(user) + end + + it 'does not preserve contacts' do + new_issue = move_service.execute(old_issue, another_project) + + expect(new_issue.customer_relations_contacts).to be_empty + end + end + + context 'when customer_relations feature is disabled' do + let(:another_project) { create(:project, namespace: create(:group)) } + + before do + stub_feature_flags(customer_relations: false) + end + + it 'does not preserve contacts' do + new_issue = move_service.execute(old_issue, new_project) + + expect(new_issue.customer_relations_contacts).to be_empty + end + end + end + context 'moving to same project' do let(:new_project) { old_project } |