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/workers/projects/post_creation_worker_spec.rb')
-rw-r--r--spec/workers/projects/post_creation_worker_spec.rb34
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