Sha256: dce4e5e8e9c43470243a05caf045e3d7f428b8f362909b7d4cefc8542cdddd69

Contents?: true

Size: 373 Bytes

Versions: 2

Compression:

Stored size: 373 Bytes

Contents

require 'nokogiri'

module APIMatchers
  module ResponseBody
    class HaveXmlNode < Base
      def matches?(actual)
        @actual = actual
        xml = Nokogiri::XML(response_body)
        node = xml.xpath("//#{@expected_node}").text

        if @with_value
          node == @with_value.to_s
        else
          node.present?
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
api_matchers-0.0.2 lib/api_matchers/response_body/have_xml_node.rb
api_matchers-0.0.1 lib/api_matchers/response_body/have_xml_node.rb