summaryrefslogtreecommitdiff
path: root/spec/migrations
diff options
context:
space:
mode:
authorAlessio Caiazza <acaiazza@gitlab.com>2018-12-12 10:56:43 +0100
committerAlessio Caiazza <acaiazza@gitlab.com>2018-12-13 12:15:21 +0100
commitb782ba1113970728989eebdf4c8fc44f8091c8d8 (patch)
treed78c36b3c216f0cf627ab3177da22c8717f390a2 /spec/migrations
parentdd62164d118c8bb741026abcab3db62aaedd18d5 (diff)
downloadgitlab-ce-b782ba1113970728989eebdf4c8fc44f8091c8d8.tar.gz
Add name, author and sha to releases
This commit adds a name to each release, defaulting it to tag name, keeps track of the SHA when a new release is created and tracks the current user as release author.
Diffstat (limited to 'spec/migrations')
-rw-r--r--spec/migrations/backfill_releases_name_with_tag_name_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/migrations/backfill_releases_name_with_tag_name_spec.rb b/spec/migrations/backfill_releases_name_with_tag_name_spec.rb
new file mode 100644
index 00000000000..6f436de84b7
--- /dev/null
+++ b/spec/migrations/backfill_releases_name_with_tag_name_spec.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+require Rails.root.join('db', 'migrate', '20181212104941_backfill_releases_name_with_tag_name.rb')
+
+describe BackfillReleasesNameWithTagName, :migration do
+ 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