Skip to content
Browse files

Failed test which demonstrates that node.to_xml does not respect AS_X…

…ML save option
  • Loading branch information...
1 parent 7ec7524 commit 9ed7f8bc45250e6c3f3a73bf9d5e182b32887e14 @mironov mironov committed with tenderlove Aug 9, 2011
Showing with 10 additions and 1 deletion.
  1. +10 −1 test/xml/test_node.rb
View
11 test/xml/test_node.rb
@@ -874,7 +874,7 @@ def test_namespace
<b:div>hello b</b:div>
<c:div>hello c</c:div>
<div>hello moon</div>
- </y>
+ </y>
</x>
EOF
set = xml.search("//y/*")
@@ -937,6 +937,15 @@ def test_blank
doc = Nokogiri::XML('')
assert_equal false, doc.blank?
end
+
+ def test_to_xml_allows_to_serialize_with_as_xml_save_option
+ xml = Nokogiri::XML("<root><ul><li>Hello world</li></ul></root>")
+ set = xml.search("//ul")
+ node = set.first
+
+ assert_no_match("<ul>\n <li>", xml.to_xml(:save_with => XML::Node::SaveOptions::AS_XML))
+ assert_no_match("<ul>\n <li>", node.to_xml(:save_with => XML::Node::SaveOptions::AS_XML))
+ end
end
end
end

0 comments on commit 9ed7f8b

Please sign in to comment.
Something went wrong with that request. Please try again.