diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-08 18:09:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-08 18:09:38 +0300 |
commit | 3bc30c280c408f3f31c90961e0fc5809c6246137 (patch) | |
tree | 4ac5bc250d6ca6b5d056ae7233f3868dc6b01297 /spec/models/note_spec.rb | |
parent | 9e74a704bc63dc1e75cc8be67b7e0a1741e6696f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r-- | spec/models/note_spec.rb | 28 |
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 |