lib/adyen/matchers.rb in adyen-0.3.7 vs lib/adyen/matchers.rb in adyen-0.3.8

- old
+ new

@@ -1,6 +1,7 @@ -require 'xml' +require 'rexml/document' +require 'rexml/xpath' module Adyen module Matchers module XPathPaymentFormCheck @@ -29,23 +30,21 @@ return xpath_query end def self.document(subject) if String === subject - XML::HTMLParser.string(subject).parse + REXML::Document.new(subject.to_s) elsif subject.respond_to?(:body) - XML::HTMLParser.string(subject.body).parse - elsif XML::Node === subject + REXML::Document.new(subject.body.to_s) + elsif REXML::Document === subject subject - elsif XML::Document === subject - subject else raise "Cannot handle this XML input type" end end def self.check(subject, checks = {}) - document(subject).find_first(build_xpath_query(checks)) + !!REXML::XPath.first(document(subject), build_xpath_query(checks)) end end class HaveAdyenPaymentForm