summaryrefslogtreecommitdiff
path: root/spec/migrations/drop_alerts_service_data_spec.rb
blob: 06382132952f9a2f558d6f53dbbc8c80fa28bb2e (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'
require_migration!

RSpec.describe DropAlertsServiceData do
  let_it_be(:alerts_service_data) { table(:alerts_service_data) }

  it 'correctly migrates up and down' do
    reversible_migration do |migration|
      migration.before -> {
        expect(alerts_service_data.create!(service_id: 1)).to be_a alerts_service_data
      }

      migration.after -> {
        expect { alerts_service_data.create!(service_id: 1) }
          .to raise_error(ActiveRecord::StatementInvalid, /UndefinedTable/)
      }
    end
  end
end