2021-09-30 23:02:18 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2021-12-11 22:18:48 +05:30
|
|
|
require_migration!
|
2021-09-30 23:02:18 +05:30
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
RSpec.describe CascadeDeleteFreezePeriods, :suppress_gitlab_schemas_validate_connection do
|
2021-09-30 23:02:18 +05:30
|
|
|
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
|