summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/background_migration/backfill_topics_title_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/background_migration/backfill_topics_title_spec.rb')
-rw-r--r--spec/lib/gitlab/background_migration/backfill_topics_title_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/lib/gitlab/background_migration/backfill_topics_title_spec.rb b/spec/lib/gitlab/background_migration/backfill_topics_title_spec.rb
new file mode 100644
index 00000000000..3c46456eed0
--- /dev/null
+++ b/spec/lib/gitlab/background_migration/backfill_topics_title_spec.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::BackgroundMigration::BackfillTopicsTitle, schema: 20220331133802 do
+ it 'correctly backfills the title of the topics' do
+ topics = table(:topics)
+
+ topic_1 = topics.create!(name: 'topic1')
+ topic_2 = topics.create!(name: 'topic2', title: 'Topic 2')
+ topic_3 = topics.create!(name: 'topic3')
+ topic_4 = topics.create!(name: 'topic4')
+
+ subject.perform(topic_1.id, topic_3.id)
+
+ expect(topic_1.reload.title).to eq('topic1')
+ expect(topic_2.reload.title).to eq('Topic 2')
+ expect(topic_3.reload.title).to eq('topic3')
+ expect(topic_4.reload.title).to be_nil
+ end
+end