Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2018-02-02 13:56:38 +0300
committerStan Hu <stanhu@gmail.com>2018-02-02 17:35:40 +0300
commitb7d8098b3abcc0e13b55da0e78cca8464d921f42 (patch)
tree649937bb14b7f2c083042bd3486d65193fa2b66e /spec
parentf677aa7d574c9399400fdeeeaf0e20007bdd57f8 (diff)
add migration spec
Diffstat (limited to 'spec')
-rw-r--r--spec/migrations/remove_project_labels_group_id_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/migrations/remove_project_labels_group_id_spec.rb b/spec/migrations/remove_project_labels_group_id_spec.rb
new file mode 100644
index 00000000000..ddab6cc29d3
--- /dev/null
+++ b/spec/migrations/remove_project_labels_group_id_spec.rb
@@ -0,0 +1,21 @@
+# encoding: utf-8
+
+require 'spec_helper'
+require Rails.root.join('db', 'post_migrate', '20180202111106_remove_project_labels_group_id.rb')
+
+describe RemoveProjectLabelsGroupId, :delete do
+ let(:migration) { described_class.new }
+ let(:group) { create(:group) }
+ let!(:project_label) { create(:label, group_id: group.id) }
+ let!(:group_label) { create(:group_label) }
+
+ describe '#up' do
+ it 'updates the project labels group ID' do
+ expect { migration.up }.to change { project_label.reload.group_id }.from(1).to(nil)
+ end
+
+ it 'keeps the group labels group ID' do
+ expect { migration.up }.not_to change { group_label.reload.group_id }
+ end
+ end
+end