diff options
Diffstat (limited to 'spec/lib/gitlab/other_markup_spec.rb')
-rw-r--r-- | spec/lib/gitlab/other_markup_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/lib/gitlab/other_markup_spec.rb b/spec/lib/gitlab/other_markup_spec.rb index 607d4cc9fd5..cdeaed6d368 100644 --- a/spec/lib/gitlab/other_markup_spec.rb +++ b/spec/lib/gitlab/other_markup_spec.rb @@ -111,6 +111,22 @@ RSpec.describe Gitlab::OtherMarkup, feature_category: :wiki do end end + context 'RedCloth markup' do + it 'renders textile correctly' do + test_text = '"This is *my* text."' + expected_res = "<p>“This is <strong>my</strong> text.”</p>" + expect(RedCloth.new(test_text).to_html).to eq(expected_res) + end + + it 'protects against malicious backtracking' do + test_text = '<A' + ('A' * 54773) + + expect do + Timeout.timeout(3.seconds) { RedCloth.new(test_text, [:sanitize_html]).to_html } + end.not_to raise_error + end + end + def render(...) described_class.render(...) end |