Sha256: edbc13d73d1a2107ed3ea1ed23ba289e280ad6a8613246814f041327d9b14fba

Contents?: true

Size: 475 Bytes

Versions: 3

Compression:

Stored size: 475 Bytes

Contents

Spec::Matchers.define :match_xml_structure do |expected|
  match do |actual|
    subject = Nokogiri::XML::Document.parse(actual)
    pattern = Nokogiri::XML::Document.parse(expected)

    subject.match?(pattern)
  end

  failure_message_for_should do |actual|
    "the xml:\n#{actual}\nshould match xml structure:\n#{expected}"
  end

  failure_message_for_should_not do |actual|
    "the xml:\n#{actual}\nshould not match xml structure:\n#{expected}\nbut it does"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
test_xml-0.0.4 lib/test_xml/spec/matchers/match_xml_structure.rb
test_xml-0.0.3 lib/test_xml/spec/matchers/match_xml_structure.rb
test_xml-0.0.2 lib/test_xml/spec/matchers/match_xml_structure.rb