lib/adyen/matchers.rb in adyen-1.5.0 vs lib/adyen/matchers.rb in adyen-1.6.0

- old
+ new

@@ -19,25 +19,22 @@ end end # Add a check for all the other fields specified checks.each do |key, value| - condition = "descendant::input[@type='hidden'][@name='#{Adyen::Form.camelize(key)}']" + condition = "\n descendant::input[@type='hidden'][@name='#{Adyen::Form.camelize(key)}']" condition << "[@value='#{value}']" unless value == :anything xpath_query << "[#{condition}]" end return xpath_query end def self.check(subject, checks = {}) - found = false document = Adyen::API::XMLQuerier.html(subject) - document.xpath(build_xpath_query(checks)) do |result| - found = true - end - return found + result = document.xpath(build_xpath_query(checks)) + !result.empty? end end class HaveAdyenPaymentForm @@ -89,8 +86,7 @@ def assert_adyen_single_payment_form(subject, checks = {}) recurring_checks = { :recurring => false } assert_adyen_payment_form(subject, recurring_checks.merge(checks)) end - end end