diff --git a/lib/nokogiri/xml.rb b/lib/nokogiri/xml.rb index 197108d855c..3472d48728d 100644 --- a/lib/nokogiri/xml.rb +++ b/lib/nokogiri/xml.rb @@ -33,8 +33,8 @@ def Reader(string_or_io, url = nil, encoding = nil, options = ParseOptions::STRI ### # Parse XML. Convenience method for Nokogiri::XML::Document.parse - def parse(thing, url = nil, encoding = nil, options = ParseOptions::DEFAULT_XML, &block) - Document.parse(thing, url, encoding, options, &block) + def parse(...) + Document.parse(...) end #### diff --git a/test/xml/test_document.rb b/test/xml/test_document.rb index 5e8182bfc9a..f56f344390e 100644 --- a/test/xml/test_document.rb +++ b/test/xml/test_document.rb @@ -1101,6 +1101,13 @@ def test_can_be_closed end assert_nil(error.path) end + + it "raises exception on parse error with kwargs" do + error = assert_raises Nokogiri::SyntaxError do + Nokogiri::XML.parse(input, options: parse_options) + end + assert_nil(error.path) + end end describe "default options" do @@ -1122,6 +1129,12 @@ def test_can_be_closed Nokogiri::XML.parse(input, nil, nil, parse_options) end end + + it "raises exception on parse error with kwargs" do + assert_raises Nokogiri::SyntaxError do + Nokogiri::XML.parse(input, options: parse_options) + end + end end describe "default options" do