diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
commit | 7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch) | |
tree | 5bdc2229f5198d516781f8d24eace62fc7e589e9 /spec/workers/projects/post_creation_worker_spec.rb | |
parent | 185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff) |
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'spec/workers/projects/post_creation_worker_spec.rb')
-rw-r--r-- | spec/workers/projects/post_creation_worker_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/workers/projects/post_creation_worker_spec.rb b/spec/workers/projects/post_creation_worker_spec.rb index 3158ac9fa27..732dc540fb7 100644 --- a/spec/workers/projects/post_creation_worker_spec.rb +++ b/spec/workers/projects/post_creation_worker_spec.rb @@ -81,6 +81,40 @@ RSpec.describe Projects::PostCreationWorker do end end end + + describe 'Incident timeline event tags' do + context 'when project is nil' do + let(:job_args) { [nil] } + + it 'does not create event tags' do + expect { subject }.not_to change { IncidentManagement::TimelineEventTag.count } + end + end + + context 'when project is created', :aggregate_failures do + it 'creates tags for the project' do + expect { subject }.to change { IncidentManagement::TimelineEventTag.count }.by(2) + + expect(project.incident_management_timeline_event_tags.pluck_names).to match_array( + [ + ::IncidentManagement::TimelineEventTag::START_TIME_TAG_NAME, + ::IncidentManagement::TimelineEventTag::END_TIME_TAG_NAME + ] + ) + end + + it 'raises error if record creation fails' do + allow_next_instance_of(IncidentManagement::TimelineEventTag) do |tag| + allow(tag).to receive(:valid?).and_return(false) + end + + expect(Gitlab::ErrorTracking).to receive(:track_exception).with(an_instance_of(ActiveRecord::RecordInvalid), include(extra: { project_id: a_kind_of(Integer) })).twice + subject + + expect(project.incident_management_timeline_event_tags).to be_empty + end + end + end end end end |