Skip to content

Commit e2cf592

Browse files
committed
Use MultiXML constant to fix deprecation warning from multi_xml 0.9+
Falls back to MultiXml for older versions so no minimum version bump is required.
1 parent 5ce706d commit e2cf592

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

lib/oauth2/response.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def parser
171171
OAuth2::Response.register_parser(:xml, ["text/xml", "application/rss+xml", "application/rdf+xml", "application/atom+xml", "application/xml"]) do |body|
172172
next body unless body.respond_to?(:to_str)
173173

174-
MultiXml.parse(body)
174+
(defined?(MultiXML) ? MultiXML : MultiXml).parse(body)
175175
end
176176

177177
# Register JSON parser

spec/config/multi_xml.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
require "multi_xml"
44

5-
MultiXml.parser = :rexml
5+
(defined?(MultiXML) ? MultiXML : MultiXml).parser = :rexml

spec/oauth2/client_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,8 @@
767767
end
768768
end
769769

770-
expect { client.get_token(parse: :xml) }.to raise_error(MultiXml::ParseError)
770+
xml_parse_error = defined?(MultiXML) ? MultiXML::ParseError : MultiXml::ParseError
771+
expect { client.get_token(parse: :xml) }.to raise_error(xml_parse_error)
771772
end
772773
end
773774

0 commit comments

Comments
 (0)