debian-mirror-gitlab/spec/migrations/20191204114127_delete_legacy_triggers_spec.rb

24 lines
700 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
require 'spec_helper'
2021-09-04 01:27:46 +05:30
require_migration!('delete_legacy_triggers')
2020-03-13 15:44:24 +05:30
2020-07-28 23:09:34 +05:30
RSpec.describe DeleteLegacyTriggers, schema: 2019_11_25_140458 do
2020-03-13 15:44:24 +05:30
let(:ci_trigger_table) { table(:ci_triggers) }
let(:user) { table(:users).create!(name: 'test', email: 'test@example.com', projects_limit: 1) }
before do
@trigger_with_user = ci_trigger_table.create!(owner_id: user.id)
ci_trigger_table.create!(owner_id: nil)
ci_trigger_table.create!(owner_id: nil)
end
it 'removes legacy triggers which has null owner_id' do
expect do
migrate!
end.to change(ci_trigger_table, :count).by(-2)
expect(ci_trigger_table.all).to eq([@trigger_with_user])
end
end