2021-03-11 19:13:27 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
2021-09-04 01:27:46 +05:30
|
|
|
require_migration!
|
2021-03-11 19:13:27 +05:30
|
|
|
|
|
|
|
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
|