Commit ed6ed251 authored by Toon Claes's avatar Toon Claes

Remove unused optional parameter `asciidoc_opts`

parent a5344275
......@@ -14,15 +14,11 @@ module Gitlab
# Public: Converts the provided Asciidoc markup into HTML.
#
# input - the source text in Asciidoc format
# asciidoc_opts - a Hash of options to pass to the Asciidoctor converter
#
def self.render(input, asciidoc_opts = {})
asciidoc_opts.reverse_merge!(
safe: :secure,
def self.render(input)
asciidoc_opts = { safe: :secure,
backend: :gitlab_html5,
attributes: []
)
asciidoc_opts[:attributes].unshift(*DEFAULT_ADOC_ATTRS)
attributes: DEFAULT_ADOC_ATTRS }
plantuml_setup
......
......@@ -22,24 +22,7 @@ module Gitlab
expect(Asciidoctor).to receive(:convert)
.with(input, expected_asciidoc_opts).and_return(html)
expect( render(input, context) ).to eql html
end
context "with asciidoc_opts" do
let(:asciidoc_opts) { { safe: :safe, attributes: ['foo'] } }
it "merges the options with default ones" do
expected_asciidoc_opts = {
safe: :safe,
backend: :gitlab_html5,
attributes: described_class::DEFAULT_ADOC_ATTRS + ['foo']
}
expect(Asciidoctor).to receive(:convert)
.with(input, expected_asciidoc_opts).and_return(html)
render(input, context, asciidoc_opts)
end
expect(render(input)).to eq(html)
end
context "XSS" do
......@@ -60,7 +43,7 @@ module Gitlab
links.each do |name, data|
it "does not convert dangerous #{name} into HTML" do
expect(render(data[:input], context)).to eql data[:output]
expect(render(data[:input])).to eq(data[:output])
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment