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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-08 18:09:38 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-08 18:09:38 +0300
commit3bc30c280c408f3f31c90961e0fc5809c6246137 (patch)
tree4ac5bc250d6ca6b5d056ae7233f3868dc6b01297 /spec/models/note_spec.rb
parent9e74a704bc63dc1e75cc8be67b7e0a1741e6696f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r--spec/models/note_spec.rb28
1 files changed, 12 insertions, 16 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index 6e87ca6dcf7..5c14a3db54e 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -890,35 +890,31 @@ RSpec.describe Note do
describe '#cache_markdown_field' do
let(:html) { '<p>some html</p>'}
+ before do
+ allow(Banzai::Renderer).to receive(:cacheless_render_field).and_call_original
+ end
+
context 'note for a project snippet' do
let(:snippet) { create(:project_snippet) }
- let(:note) { build(:note_on_project_snippet, project: snippet.project, noteable: snippet) }
+ let(:note) { create(:note_on_project_snippet, project: snippet.project, noteable: snippet) }
- before do
+ it 'skips project check' do
expect(Banzai::Renderer).to receive(:cacheless_render_field)
- .with(note, :note, { skip_project_check: false }).and_return(html)
+ .with(note, :note, { skip_project_check: false })
- note.save
- end
-
- it 'creates a note' do
- expect(note.note_html).to eq(html)
+ note.update!(note: html)
end
end
context 'note for a personal snippet' do
let(:snippet) { create(:personal_snippet) }
- let(:note) { build(:note_on_personal_snippet, noteable: snippet) }
+ let(:note) { create(:note_on_personal_snippet, noteable: snippet) }
- before do
+ it 'does not skip project check' do
expect(Banzai::Renderer).to receive(:cacheless_render_field)
- .with(note, :note, { skip_project_check: true }).and_return(html)
-
- note.save
- end
+ .with(note, :note, { skip_project_check: true })
- it 'creates a note' do
- expect(note.note_html).to eq(html)
+ note.update!(note: html)
end
end
end