summaryrefslogtreecommitdiff
path: root/spec/migrations/update_notes_type_for_import_spec.rb
blob: 06195d970d8a267b1987518c29eba4414c81a658 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20170927112319_update_notes_type_for_import.rb')

describe UpdateNotesTypeForImport, :migration do
  let(:notes) { table(:notes) }

  before do
    notes.inheritance_column = nil

    notes.create(type: 'Note')
    notes.create(type: 'LegacyDiffNote')
    notes.create(type: 'Github::Import::Note')
    notes.create(type: 'Github::Import::LegacyDiffNote')
  end

  it 'updates the notes type' do
    migrate!

    expect(notes.pluck(:type))
      .to contain_exactly('Note', 'Note', 'LegacyDiffNote', 'Github::Import::LegacyDiffNote')
  end
end