Module: TestXml::TestUnit

Includes:
Matchers
Included in:
Test::Unit::TestCase
Defined in:
lib/test_xml/test_unit.rb

Instance Method Summary collapse

Methods included from Matchers

#match_xml?

Instance Method Details

#assert_match_xml(xml, message = "") ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/test_xml/test_unit.rb', line 5

def assert_match_xml(xml, message = "")
  pattern = yield
  full_message = build_message(message, <<-EOT, xml, pattern)
    The following xml:
    ?
    does not match with:
    ?
  EOT
  assert_block(full_message) do
    match_xml?(xml, yield, true)
  end
end

#assert_match_xml_structure(xml, message = "") ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/test_xml/test_unit.rb', line 18

def assert_match_xml_structure(xml, message = "")
  pattern = yield
  full_message = build_message(message, <<-EOT, xml, pattern)
    The following xml:
    ?
    does not match with structure of:
    ?
  EOT
  assert_block(full_message) do
    match_xml?(xml, yield)
  end
end

#assert_not_match_xml(xml, message = "") ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/test_xml/test_unit.rb', line 31

def assert_not_match_xml(xml, message = "")
  pattern = yield
  full_message = build_message(message, <<-EOT, xml, pattern)
    The following xml:
    ?
    matches with:
    ?
  EOT
  assert_block(full_message) do
    !match_xml?(xml, yield, true)
  end
end