diff options
author | Toon Claes <toon@iotcl.com> | 2017-09-15 08:58:21 +0200 |
---|---|---|
committer | Toon Claes <toon@iotcl.com> | 2017-12-13 21:26:01 +0100 |
commit | 2acf3a564c4d042b4cf5463867bd5d37723509f5 (patch) | |
tree | 76be3f9413422d7444f58b3750e10e0677d94ec7 /spec/models | |
parent | 43b98944fb34d1a3ca37ae598327e4575d2ec315 (diff) | |
download | gitlab-ce-2acf3a564c4d042b4cf5463867bd5d37723509f5.tar.gz |
Make mail notifications of discussion notes In-Reply-To of each other
When a note is part of a discussion, the email sent out should be
`In-Reply-To` the previous note in that discussion.
Closes gitlab-org/gitlab-ce#36054
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/note_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index e1a0c55b6a6..cf79ecf00c2 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -756,6 +756,31 @@ describe Note do end end + describe '#replies_to' do + context 'when part of a discussion' do + let(:note) { create(:discussion_note_on_issue) } + + 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) + end + end + + context 'when not part of a discussion' do + subject { create(:note) } + let(:note) { create(:note, in_reply_to: subject) } + + it 'returns the noteable' do + expect(note.replies_to).to eq(note.noteable) + end + end + end + describe 'expiring ETag cache' do let(:note) { build(:note_on_issue) } |