Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2016-07-21 20:15:31 +0300
committerAhmad Sherif <me@ahmadsherif.com>2016-07-21 22:17:25 +0300
commit0c14c6332d38704a7bfd8916a8deedd5c5808978 (patch)
treebb877c98ef54f225ec13196c06d2f398c9131ec4 /spec/models/note_spec.rb
parent89292551295418cf4b5b90ce904a6b41f19a8be3 (diff)
Retrieve rendered HTML from cache in one request
See #19985
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r--spec/models/note_spec.rb40
1 files changed, 24 insertions, 16 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index 7d0697dab42..1243f5420a7 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -135,22 +135,30 @@ 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,
- 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
+ expect(Banzai::Renderer).to receive(:cache_collection_render).
+ with([{
+ text: note1.note,
+ context: {
+ pipeline: :note,
+ cache_key: [note1, "note"],
+ project: note1.project,
+ author: note1.author
+ }
+ }]).and_call_original
+
+ expect(Banzai::Renderer).to receive(:cache_collection_render).
+ with([{
+ text: note2.note,
+ context: {
+ pipeline: :note,
+ cache_key: [note2, "note"],
+ project: note2.project,
+ author: note2.author
+ }
+ }]).and_call_original
+
+ note1.all_references.users
+ note2.all_references.users
end
end