Permalink
Browse files

Added test for empty CDATA bug in from_xml

  • Loading branch information...
1 parent 3331166 commit 245017765644745b0e550ceaf815ea4e73a12681 Bradley Harris committed Apr 29, 2011
Showing with 8 additions and 2 deletions.
  1. +8 −2 activesupport/test/core_ext/hash_ext_test.rb
View
10 activesupport/test/core_ext/hash_ext_test.rb
@@ -897,7 +897,13 @@ def test_tag_with_attrs_and_whitespace
hash = Hash.from_xml(xml)
assert_equal "bacon is the best", hash['blog']['name']
end
-
+
+ def test_empty_cdata_from_xml
+ xml = "<content><![CDATA[]]></content>"
+
+ assert_equal "", Hash.from_xml(xml)["content"]
+ end
+
def test_xsd_like_types_from_xml
bacon_xml = <<-EOT
<bacon>
@@ -940,7 +946,7 @@ def test_type_trickles_through_when_unknown
assert_equal expected_product_hash, Hash.from_xml(product_xml)["product"]
end
-
+
def test_should_use_default_value_for_unknown_key
hash_wia = HashWithIndifferentAccess.new(3)
assert_equal 3, hash_wia[:new_key]

0 comments on commit 2450177

Please sign in to comment.