diff options
Diffstat (limited to 'spec/helpers/markup_helper_spec.rb')
-rw-r--r-- | spec/helpers/markup_helper_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/helpers/markup_helper_spec.rb b/spec/helpers/markup_helper_spec.rb index a775c69335e..2f91ab3afb3 100644 --- a/spec/helpers/markup_helper_spec.rb +++ b/spec/helpers/markup_helper_spec.rb @@ -138,10 +138,20 @@ describe MarkupHelper do describe 'without redacted attribute' do it 'renders the markdown value' do expect(Banzai).to receive(:render_field).with(commit, attribute, {}).and_call_original + expect(Banzai).to receive(:post_process) helper.markdown_field(commit, attribute) end end + + context 'when post_process is false' do + it 'does not run Markdown post processing' do + expect(Banzai).to receive(:render_field).with(commit, attribute, {}).and_call_original + expect(Banzai).not_to receive(:post_process) + + helper.markdown_field(commit, attribute, post_process: false) + end + end end describe '#link_to_markdown_field' do @@ -565,6 +575,14 @@ describe MarkupHelper do expect(doc.content).to eq "foo 😉\nbar 😀" end + + it 'does not post-process truncated text', :request_store do + object = create_object("hello \n\n [Test](README.md)") + + expect do + first_line_in_markdown(object, attribute, nil, project: project) + end.not_to change { Gitlab::GitalyClient.get_request_count } + end end context 'when the asked attribute can be redacted' do |