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/services/issues')
-rw-r--r--spec/services/issues/create_service_spec.rb45
-rw-r--r--spec/services/issues/move_service_spec.rb14
-rw-r--r--spec/services/issues/update_service_spec.rb8
3 files changed, 45 insertions, 22 deletions
diff --git a/spec/services/issues/create_service_spec.rb b/spec/services/issues/create_service_spec.rb
index 3934ca04a00..5c1544d8ebc 100644
--- a/spec/services/issues/create_service_spec.rb
+++ b/spec/services/issues/create_service_spec.rb
@@ -66,6 +66,7 @@ RSpec.describe Issues::CreateService do
expect(issue.milestone).to eq(milestone)
expect(issue.due_date).to eq(Date.tomorrow)
expect(issue.work_item_type.base_type).to eq('issue')
+ expect(issue.issue_customer_relations_contacts).to be_empty
end
context 'when a build_service is provided' do
@@ -444,6 +445,50 @@ RSpec.describe Issues::CreateService do
expect(issue.issue_customer_relations_contacts.last.contact).to eq(contact)
end
end
+
+ context 'with external_author' do
+ let_it_be(:contact) { create(:contact, group: group) }
+
+ context 'when CRM contact exists with matching e-mail' do
+ let(:opts) do
+ {
+ title: 'Title',
+ external_author: contact.email
+ }
+ end
+
+ context 'with permission' do
+ it 'assigns contact to issue' do
+ group.add_reporter(user)
+ expect(issue).to be_persisted
+ expect(issue.issue_customer_relations_contacts.last.contact).to eq(contact)
+ end
+ end
+
+ context 'without permission' do
+ it 'does not assign contact to issue' do
+ group.add_guest(user)
+ expect(issue).to be_persisted
+ expect(issue.issue_customer_relations_contacts).to be_empty
+ end
+ end
+ end
+
+ context 'when no CRM contact exists with matching e-mail' do
+ let(:opts) do
+ {
+ title: 'Title',
+ external_author: 'example@gitlab.com'
+ }
+ end
+
+ it 'does not assign contact to issue' do
+ group.add_reporter(user)
+ expect(issue).to be_persisted
+ expect(issue.issue_customer_relations_contacts).to be_empty
+ end
+ end
+ end
end
context 'resolving discussions' do
diff --git a/spec/services/issues/move_service_spec.rb b/spec/services/issues/move_service_spec.rb
index 35a380e01d0..56a3c22cd7f 100644
--- a/spec/services/issues/move_service_spec.rb
+++ b/spec/services/issues/move_service_spec.rb
@@ -194,20 +194,6 @@ RSpec.describe Issues::MoveService do
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
diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb
index d496857bb25..d11fe772023 100644
--- a/spec/services/issues/update_service_spec.rb
+++ b/spec/services/issues/update_service_spec.rb
@@ -1230,14 +1230,6 @@ RSpec.describe Issues::UpdateService, :mailer do
it_behaves_like 'updates the escalation status record', :acknowledged
end
-
- context 'with :incident_escalations feature flag disabled' do
- before do
- stub_feature_flags(incident_escalations: false)
- end
-
- it_behaves_like 'does not change the status record'
- end
end
context 'when issue type is not incident' do