debian-mirror-gitlab/spec/migrations/2021061716138_cascade_delete_freeze_periods_spec.rb
2022-08-27 11:52:29 +05:30

22 lines
727 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe CascadeDeleteFreezePeriods, :suppress_gitlab_schemas_validate_connection do
let(:namespace) { table(:namespaces).create!(name: 'deploy_freeze', path: 'deploy_freeze') }
let(:project) { table(:projects).create!(id: 1, namespace_id: namespace.id) }
let(:freeze_periods) { table(:ci_freeze_periods) }
describe "#up" do
it 'allows for a project to be deleted' do
freeze_periods.create!(id: 1, project_id: project.id, freeze_start: '5 * * * *', freeze_end: '6 * * * *', cron_timezone: 'UTC')
migrate!
project.delete
expect(freeze_periods.where(project_id: project.id).count).to be_zero
end
end
end