require 'test_helper'
class TestAssertions < Test::Unit::TestCase
def test_assert_xml_contain_message_if_fails
begin
assert_xml_contain("12", "3")
rescue Exception => e
assert_match %r{the xml:\n12\nshould contain xml:\n3}, e.message
end
end
def test_assert_xml_not_contain_message_if_fails
begin
assert_not_xml_contain("12", "12")
rescue Exception => e
assert_match %r{the xml:\n12\nshould not contain xml:\n12 but it does}, e.message
end
end
def test_assert_xml_contain
expected = <<-XML
1
2
XML
actual = <<-XML
1
XML
assert_xml_contain expected, actual
end
def test_assert_not_xml_contain
expected = <<-XML
1
XML
actual = <<-XML
2
XML
assert_not_xml_contain expected, actual
end
def test_assert_xml_structure_contain
expected = <<-XML
1
3
XML
actual = <<-XML
2
4
XML
assert_xml_structure_contain expected, actual
end
def test_assert_not_xml_structure_contain
expected = <<-XML
1
3
XML
actual = <<-XML
2
XML
assert_not_xml_structure_contain expected, actual
end
def test_assert_xml_equal
expected = <<-XML
1
2
XML
actual = <<-XML
1
2
XML
assert_xml_equal expected, actual
end
def test_assert_xml_equal_with_attributes
expected = <<-XML
1
XML
actual = <<-XML
1
XML
assert_xml_equal expected, actual
end
def test_assert_xml_equal_with_attributes_in_branch_element
expected = <<-XML
1
XML
actual = <<-XML
1
XML
assert_xml_equal expected, actual
end
def test_assert_not_xml_equal_with_attributes
expected = <<-XML
1
XML
actual = <<-XML
1
XML
assert_not_xml_equal expected, actual
end
def test_assert_not_xml_equal_with_attributes_and_no_text
expected = <<-XML
XML
actual = <<-XML
XML
assert_not_xml_equal expected, actual
end
def test_assert_not_xml_equal_with_attributes_in_branch_element
expected = <<-XML
1
XML
actual = <<-XML
1
XML
assert_not_xml_equal expected, actual
end
def test_assert_not_xml_equal
expected = <<-XML
1
2
XML
actual = <<-XML
1
XML
assert_not_xml_equal expected, actual
end
def test_assert_xml_structure_equal
expected = <<-XML
1
3
XML
actual = <<-XML
2
4
XML
assert_xml_structure_equal expected, actual
end
def test_assert_not_xml_structure_equal
expected = <<-XML
1
3
XML
actual = <<-XML
2
3
XML
assert_not_xml_structure_equal expected, actual
end
end