summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-01-06 18:11:46 +0000
committerRobert Speicher <robert@gitlab.com>2016-01-06 18:11:46 +0000
commit623fa2caf70f9d1eef63fdbee448adedc4c0ede8 (patch)
tree8b6c1b25070f529927ffb5e1ba66b566f5972f84 /spec
parentbcd2a09da72d430773b4b4bbc700132aade641d7 (diff)
parent18b17072c6cc7eb199d1da34a3ea481dcd53a8cf (diff)
downloadgitlab-ce-623fa2caf70f9d1eef63fdbee448adedc4c0ede8.tar.gz
Merge branch 'fix-banzai-cache' into 'master'
Fix mentionable reference extraction caching. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/4130 Reverts https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/2120 and https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/2283 See merge request !2315
Diffstat (limited to 'spec')
-rw-r--r--spec/models/note_spec.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index 593d8f76215..151a29e974b 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -125,6 +125,19 @@ describe Note, models: true do
let(:set_mentionable_text) { ->(txt) { subject.note = txt } }
end
+ describe "#all_references" do
+ let!(:note1) { create(:note) }
+ let!(:note2) { create(:note) }
+
+ 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)
+
+ note1.all_references
+ note2.all_references
+ end
+ end
+
describe :search do
let!(:note) { create(:note, note: "WoW") }
@@ -164,7 +177,7 @@ describe Note, models: true do
expect(note.editable?).to be_falsy
end
end
-
+
describe "set_award!" do
let(:issue) { create :issue }