summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRubén Dávila <ruben@gitlab.com>2015-11-20 13:58:45 -0500
committerRubén Dávila <ruben@gitlab.com>2015-11-20 13:58:45 -0500
commit3aabed3456506d1a917e6daba29cd46ce6a25dab (patch)
treef58582086f71534e254f0b792db9e27c5bf4d4b6 /spec
parentfa9f2dec0e07ff3ae3a2acd6ee0586e317bdb7b6 (diff)
downloadgitlab-ce-3aabed3456506d1a917e6daba29cd46ce6a25dab.tar.gz
Fix bug that happened when replacing the Task list. #2296
REF: https://gitlab.com/gitlab-org/gitlab-ce/issues/2296#note_2724697
Diffstat (limited to 'spec')
-rw-r--r--spec/services/issues/update_service_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb
index adb3aa143ae..bc6a26416a2 100644
--- a/spec/services/issues/update_service_spec.rb
+++ b/spec/services/issues/update_service_spec.rb
@@ -121,6 +121,25 @@ describe Issues::UpdateService do
expect(note).to be_nil
end
end
+
+ context 'when a Task list with a completed item is totally replaced' do
+ before do
+ update_issue({ description: "- [ ] Task 1\n- [X] Task 2" })
+ update_issue({ description: "- [ ] One\n- [ ] Two\n- [ ] Three" })
+ end
+
+ it 'does not create a system note referencing the position the old item' do
+ note = find_note('Marked the task **Two** as incomplete')
+
+ expect(note).to be_nil
+ end
+
+ it 'should not generate a new note at all' do
+ expect {
+ update_issue({ description: "- [ ] One\n- [ ] Two\n- [ ] Three" })
+ }.not_to change { Note.count }
+ end
+ end
end
end