summaryrefslogtreecommitdiff
path: root/spec/models/note_spec.rb
diff options
context:
space:
mode:
authorToon Claes <toon@iotcl.com>2017-12-08 22:45:57 +0100
committerToon Claes <toon@iotcl.com>2017-12-13 21:26:01 +0100
commitf55aaca561986757343fb410a9e6c09cfcc61385 (patch)
tree1c84b54d8cefa3af4768af4cf31740107f188cb2 /spec/models/note_spec.rb
parent2acf3a564c4d042b4cf5463867bd5d37723509f5 (diff)
downloadgitlab-ce-f55aaca561986757343fb410a9e6c09cfcc61385.tar.gz
Make discussion mail References all notes in the discussiontc-correct-email-in-reply-to
When a note is part of a discussion, the email sent out will be `In-Reply-To` the previous note in that discussion. It also `References` all the previous notes in that discussion, and the original issue. Closes gitlab-org/gitlab-ce#36054.
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r--spec/models/note_spec.rb19
1 files changed, 8 insertions, 11 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index cf79ecf00c2..cefbf60b28c 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -756,18 +756,15 @@ describe Note do
end
end
- describe '#replies_to' do
+ describe '#references' do
context 'when part of a discussion' do
- let(:note) { create(:discussion_note_on_issue) }
+ it 'references all earlier notes in the discussion' do
+ first_note = create(:discussion_note_on_issue)
+ second_note = create(:discussion_note_on_issue, in_reply_to: first_note)
+ third_note = create(:discussion_note_on_issue, in_reply_to: second_note)
+ create(:discussion_note_on_issue, in_reply_to: third_note)
- it 'returns noteable when there are not earlier notes in the discussion' do
- expect(note.replies_to).to eq(note.noteable)
- end
-
- it 'returns previous note in discussion' do
- reply = create(:discussion_note_on_issue, in_reply_to: note)
-
- expect(reply.replies_to).to eq(note)
+ expect(third_note.references).to eq([first_note.noteable, first_note, second_note])
end
end
@@ -776,7 +773,7 @@ describe Note do
let(:note) { create(:note, in_reply_to: subject) }
it 'returns the noteable' do
- expect(note.replies_to).to eq(note.noteable)
+ expect(note.references).to eq([note.noteable])
end
end
end