summaryrefslogtreecommitdiff
path: root/spec/services/issues
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-01-10 17:20:50 -0800
committerStan Hu <stanhu@gmail.com>2018-01-10 17:22:56 -0800
commit95865da5499a794c539d43b1adfb33d98da97ba2 (patch)
tree4f0ad1af7be5337d292add3e2bc9da69ee221471 /spec/services/issues
parent3576d59ae95a61dd20e997a619dbc6c8e8a70276 (diff)
downloadgitlab-ce-95865da5499a794c539d43b1adfb33d98da97ba2.tar.gz
Fix bug where award emojis would be lost when moving issues between projectssh-fix-award-emoji-move-issues
Closes #33423
Diffstat (limited to 'spec/services/issues')
-rw-r--r--spec/services/issues/move_service_spec.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/spec/services/issues/move_service_spec.rb b/spec/services/issues/move_service_spec.rb
index 53ea88332fb..f3c98fa5416 100644
--- a/spec/services/issues/move_service_spec.rb
+++ b/spec/services/issues/move_service_spec.rb
@@ -179,13 +179,15 @@ describe Issues::MoveService do
{ system: true, note: 'Some system note' },
{ system: false, note: 'Some comment 2' }]
end
-
+ let(:award_names) { %w(thumbsup thumbsdown facepalm) }
let(:notes_contents) { notes_params.map { |n| n[:note] } }
before do
note_params = { noteable: old_issue, project: old_project, author: author }
- notes_params.each do |note|
- create(:note, note_params.merge(note))
+ notes_params.each_with_index do |note, index|
+ new_note = create(:note, note_params.merge(note))
+ award_emoji_params = { awardable: new_note, name: award_names[index] }
+ create(:award_emoji, award_emoji_params)
end
end
@@ -199,6 +201,10 @@ describe Issues::MoveService do
expect(all_notes.pluck(:note).first(3)).to eq notes_contents
end
+ it 'creates new emojis for the new notes' do
+ expect(all_notes.map(&:award_emoji).to_a.flatten.map(&:name)).to eq award_names
+ end
+
it 'adds a system note about move after rewritten notes' do
expect(system_notes.last.note).to match /^moved from/
end