From 0a530bfd63eb681cb88e101c13ab6759f47b713c Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 2 Jan 2022 19:16:04 +0100 Subject: [PATCH] Add test cases for invalid URIs in Markdown --- spec/helpers/markdown_helper_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/helpers/markdown_helper_spec.rb b/spec/helpers/markdown_helper_spec.rb index c6c387da..23674ee3 100644 --- a/spec/helpers/markdown_helper_spec.rb +++ b/spec/helpers/markdown_helper_spec.rb @@ -62,6 +62,14 @@ describe MarkdownHelper, :type => :helper do it 'should not process any markup aside of links' do expect(question_markdown('**your account has been disabled**, [click here to enable it again](https://evil.example.com)')). to eq('

**your account has been disabled**, [click here to enable it again](https://evil.example.com)

') end + + it 'should not raise an exception if an invalid link is processed' do + expect{ question_markdown('https://example.com/example.質問') }.not_to raise_error + end + + it 'should not process invalid links' do + expect(question_markdown('https://example.com/example.質問')).to eq('

https://example.com/example.質問

') + end end describe '#raw_markdown' do