debian-mirror-gitlab/spec/migrations/20220222192525_remove_null_releases_spec.rb
2023-03-04 22:38:38 +05:30

22 lines
665 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe RemoveNullReleases, feature_category: :release_orchestration do
let(:releases) { table(:releases) }
before do
# we need to migrate to before previous migration so an invalid record can be created
migrate!
migration_context.down(previous_migration(3).version)
releases.create!(tag: 'good', name: 'good release', released_at: Time.now)
releases.create!(tag: nil, name: 'bad release', released_at: Time.now)
end
it 'deletes template records and associated data' do
expect { migrate! }
.to change { releases.count }.from(2).to(1)
end
end