Welcome to mirror list, hosted at ThFree Co, Russian Federation.

backfill_topics_title_spec.rb « background_migration « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3c46456eed0a85f0fe2aacd92ae3dbc18248129c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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