2018-12-12 09:56:43 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
require Rails.root.join('db', 'migrate', '20181212104941_backfill_releases_name_with_tag_name.rb')
|
|
|
|
|
2020-03-11 21:09:19 +00:00
|
|
|
describe BackfillReleasesNameWithTagName do
|
2018-12-12 09:56:43 +00:00
|
|
|
let(:releases) { table(:releases) }
|
|
|
|
let(:namespaces) { table(:namespaces) }
|
|
|
|
let(:projects) { table(:projects) }
|
|
|
|
|
|
|
|
let(:namespace) { namespaces.create(name: 'foo', path: 'foo') }
|
|
|
|
let(:project) { projects.create!(namespace_id: namespace.id) }
|
|
|
|
let(:release) { releases.create!(project_id: project.id, tag: 'v1.0.0') }
|
|
|
|
|
|
|
|
it 'defaults name to tag value' do
|
|
|
|
expect(release.tag).to be_present
|
|
|
|
|
|
|
|
migrate!
|
|
|
|
|
|
|
|
release.reload
|
|
|
|
expect(release.name).to eq(release.tag)
|
|
|
|
end
|
|
|
|
end
|