summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2019-03-06 13:05:55 -0500
committerRobert Speicher <rspeicher@gmail.com>2019-03-06 13:05:55 -0500
commitce23d6e64d59a8fadcc86bb25a157607322b09e3 (patch)
tree5ff90a68311a3d9ef49096144127bb0555d9b900 /spec
parent397ab0fba72f274cb86778a0de279f4ec88b988a (diff)
downloadgitlab-ce-ce23d6e64d59a8fadcc86bb25a157607322b09e3.tar.gz
Revert "Merge branch '54924-clean-up-data' into 'master'"
This reverts commit c9ecc71ab91b0b55f9aba632f9e7b305191a458c, reversing changes made to c3c8dbf8fa4090bb090071d320a31857eb709d3d.
Diffstat (limited to 'spec')
-rw-r--r--spec/migrations/clean_up_noteable_id_for_notes_on_commits_spec.rb34
1 files changed, 0 insertions, 34 deletions
diff --git a/spec/migrations/clean_up_noteable_id_for_notes_on_commits_spec.rb b/spec/migrations/clean_up_noteable_id_for_notes_on_commits_spec.rb
deleted file mode 100644
index bb3038ada6e..00000000000
--- a/spec/migrations/clean_up_noteable_id_for_notes_on_commits_spec.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-require Rails.root.join('db', 'migrate', '20190228092516_clean_up_noteable_id_for_notes_on_commits.rb')
-
-describe CleanUpNoteableIdForNotesOnCommits, :migration do
- let(:notes) { table(:notes) }
-
- before do
- notes.create!(noteable_type: 'Commit', commit_id: '3d0a182204cece4857f81c6462720e0ad1af39c9', noteable_id: 3, note: 'Test')
- notes.create!(noteable_type: 'Commit', commit_id: '3d0a182204cece4857f81c6462720e0ad1af39c9', noteable_id: 3, note: 'Test')
- notes.create!(noteable_type: 'Commit', commit_id: '3d0a182204cece4857f81c6462720e0ad1af39c9', noteable_id: 3, note: 'Test')
-
- notes.create!(noteable_type: 'Issue', noteable_id: 1, note: 'Test')
- notes.create!(noteable_type: 'MergeRequest', noteable_id: 1, note: 'Test')
- notes.create!(noteable_type: 'Snippet', noteable_id: 1, note: 'Test')
- end
-
- it 'clears noteable_id for notes on commits' do
- expect { migrate! }.to change { dirty_notes_on_commits.count }.from(3).to(0)
- end
-
- it 'does not clear noteable_id for other notes' do
- expect { migrate! }.not_to change { other_notes.count }
- end
-
- def dirty_notes_on_commits
- notes.where(noteable_type: 'Commit').where('noteable_id IS NOT NULL')
- end
-
- def other_notes
- notes.where("noteable_type != 'Commit' AND noteable_id IS NOT NULL")
- end
-end