lib/adyen/matchers.rb in adyen-1.4.0 vs lib/adyen/matchers.rb in adyen-1.4.1

- old
+ new

@@ -1,7 +1,6 @@ -require 'rexml/document' -require 'rexml/xpath' +require 'adyen/api/xml_querier' module Adyen module Matchers module XPathPaymentFormCheck @@ -28,23 +27,16 @@ end return xpath_query end - def self.document(subject) - if String === subject - REXML::Document.new(subject.to_s) - elsif subject.respond_to?(:body) - REXML::Document.new(subject.body.to_s) - elsif REXML::Document === subject - subject - else - raise "Cannot handle this XML input type" - end - end - def self.check(subject, checks = {}) - !!REXML::XPath.first(document(subject), build_xpath_query(checks)) + found = false + document = Adyen::API::XMLQuerier.html(subject) + document.xpath(build_xpath_query(checks)) do |result| + found = true + end + return found end end class HaveAdyenPaymentForm