From c54a8a1238f3df5c375e5fa5cb4c8084f2b60ff4 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Fri, 3 Mar 2023 16:50:20 -0800 Subject: [PATCH] Add tests of HTML sanitization --- spec/helpers/format_helper_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/helpers/format_helper_spec.rb b/spec/helpers/format_helper_spec.rb index 4e64eb94..31adf107 100644 --- a/spec/helpers/format_helper_spec.rb +++ b/spec/helpers/format_helper_spec.rb @@ -16,5 +16,13 @@ describe FormatHelper, type: :helper do it 'should return HTML for header markdown' do expect(markdown('# this is my header')).to eq "

this is my header

\n" end + + it 'escapes input HTML' do + expect(markdown('*a*')).to eq "

<em>a</em>

\n" + end + + it 'removes unallowed elements' do + expect(markdown('**', false)).to eq "

a

\n" + end end end