diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /spec/services/issues/create_service_spec.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'spec/services/issues/create_service_spec.rb')
-rw-r--r-- | spec/services/issues/create_service_spec.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/spec/services/issues/create_service_spec.rb b/spec/services/issues/create_service_spec.rb index 8496bd31e00..b2dcfb5c6d3 100644 --- a/spec/services/issues/create_service_spec.rb +++ b/spec/services/issues/create_service_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe Issues::CreateService do include AfterNextHelpers - let_it_be(:group) { create(:group) } + let_it_be(:group) { create(:group, :crm_enabled) } let_it_be_with_reload(:project) { create(:project, group: group) } let_it_be(:user) { create(:user) } @@ -61,6 +61,7 @@ RSpec.describe Issues::CreateService do expect(Issuable::CommonSystemNotesService).to receive_message_chain(:new, :execute) expect(issue).to be_persisted + expect(issue).to be_a(::Issue) expect(issue.title).to eq('Awesome issue') expect(issue.assignees).to eq([assignee]) expect(issue.labels).to match_array(labels) @@ -69,6 +70,18 @@ RSpec.describe Issues::CreateService do expect(issue.work_item_type.base_type).to eq('issue') end + context 'when a build_service is provided' do + let(:issue) { described_class.new(project: project, current_user: user, params: opts, spam_params: spam_params, build_service: build_service).execute } + + let(:issue_from_builder) { WorkItem.new(project: project, title: 'Issue from builder') } + let(:build_service) { double(:build_service, execute: issue_from_builder) } + + it 'uses the provided service to build the issue' do + expect(issue).to be_persisted + expect(issue).to be_a(WorkItem) + end + end + context 'when skip_system_notes is true' do let(:issue) { described_class.new(project: project, current_user: user, params: opts, spam_params: spam_params).execute(skip_system_notes: true) } @@ -101,11 +114,11 @@ RSpec.describe Issues::CreateService do end it_behaves_like 'incident issue' - it_behaves_like 'has incident label' + it_behaves_like 'does not have incident label' - it 'does create an incident label' do + it 'does not create an incident label' do expect { subject } - .to change { Label.where(incident_label_attributes).count }.by(1) + .to not_change { Label.where(incident_label_attributes).count } end it 'calls IncidentManagement::Incidents::CreateEscalationStatusService' do |