diff options
Diffstat (limited to 'spec/lib/gitlab/other_markup_spec.rb')
-rw-r--r-- | spec/lib/gitlab/other_markup_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/lib/gitlab/other_markup_spec.rb b/spec/lib/gitlab/other_markup_spec.rb new file mode 100644 index 00000000000..d6d53e8586c --- /dev/null +++ b/spec/lib/gitlab/other_markup_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe Gitlab::OtherMarkup, lib: true do + let(:context) { {} } + + context "XSS Checks" do + links = { + 'links' => { + file: 'file.rdoc', + input: 'XSS[JaVaScriPt:alert(1)]', + output: "\n" + '<p><a>XSS</a></p>' + "\n" + } + } + links.each do |name, data| + it "does not convert dangerous #{name} into HTML" do + expect(render(data[:file], data[:input])).to eq(data[:output]) + end + end + end + + def render(*args) + described_class.render(*args) + end +end |