diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-06-01 18:51:59 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-06-01 18:51:59 +0300 |
commit | 2d084dd8481417ba8031a378d68009738d076229 (patch) | |
tree | 6c91c3ce35a66bdd1fa1d7806da51968d564ad73 /spec/models/note_spec.rb | |
parent | ef6fe42ec05d40935154d2bb22a44fdb7d1eac8e (diff) | |
parent | 580d250166d97bd5c2b0526be737d02806e577c2 (diff) |
Merge branch 'separate-banzai-references' into 'master'
Separate reference gathering from rendering
This is a required step to allow batch processing when gathering references. This in turn would allow grabbing (for example) all mentioned users of an issue/merge request using a single query.
cc @rspeicher @DouweM
See merge request !3969
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r-- | spec/models/note_spec.rb | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 0e052907eec..b25150f7055 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -121,8 +121,19 @@ describe Note, models: true do let!(:note2) { create(:note_on_issue) } it "reads the rendered note body from the cache" do - expect(Banzai::Renderer).to receive(:render).with(note1.note, pipeline: :note, cache_key: [note1, "note"], project: note1.project) - expect(Banzai::Renderer).to receive(:render).with(note2.note, pipeline: :note, cache_key: [note2, "note"], project: note2.project) + expect(Banzai::Renderer).to receive(:render). + with(note1.note, + pipeline: :note, + cache_key: [note1, "note"], + project: note1.project, + author: note1.author) + + expect(Banzai::Renderer).to receive(:render). + with(note2.note, + pipeline: :note, + cache_key: [note2, "note"], + project: note2.project, + author: note2.author) note1.all_references note2.all_references @@ -248,4 +259,14 @@ describe Note, models: true do expect { note.valid? }.to change(note, :line_code).to(nil) end end + + describe '#participants' do + it 'includes the note author' do + project = create(:project, :public) + issue = create(:issue, project: project) + note = create(:note_on_issue, noteable: issue, project: project) + + expect(note.participants).to include(note.author) + end + end end |