gitlab-org--gitlab-foss/spec/lib/gitlab/other_markup_spec.rb

25 lines
533 B
Ruby
Raw Normal View History

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
2017-04-24 10:20:46 +00:00
expect(render(data[:file], data[:input])).to eq(data[:output])
end
end
end
def render(*args)
described_class.render(*args)
end
end