Sha256: 436ea17098b5ae8e2ffd068fb2e987b7416554b1a43eec0d51f87b2a0dcec2b0
Contents?: true
Size: 899 Bytes
Versions: 8
Compression:
Stored size: 899 Bytes
Contents
module TestXml # This module implements the actual matchers with their conditions. module MatcherMethods def self.xml_contain(subject, pattern) actual, expected = parse_xml(subject, pattern) actual.match?(expected, true) end def self.xml_equal(subject, pattern) actual, expected = parse_xml(subject, pattern) actual.match?(expected, true) && expected.match?(actual, true) end def self.xml_structure_contain(subject, pattern) actual, expected = parse_xml(subject, pattern) actual.match?(expected) end def self.xml_structure_equal(subject, pattern) actual, expected = parse_xml(subject, pattern) actual.match?(expected) && expected.match?(actual) end private def self.parse_xml(subject, pattern) [Nokogiri::XML.parse(subject).root, Nokogiri::XML.parse(pattern).root] end end end
Version data entries
8 entries across 8 versions & 2 rubygems