aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorBradley Harris <bharris@bharris-mbpro.dyn.sermo.lan>2011-04-29 14:09:06 -0400
committerBradley Harris <bharris@bharris-mbpro.dyn.sermo.lan>2011-04-29 14:09:06 -0400
commit245017765644745b0e550ceaf815ea4e73a12681 (patch)
tree6eb28115897246575b2d31dacc7c949af64f6602 /activesupport/test/core_ext
parent3331166b48281be27d10b59e2441cb06dc3fc740 (diff)
downloadrails-245017765644745b0e550ceaf815ea4e73a12681.tar.gz
rails-245017765644745b0e550ceaf815ea4e73a12681.tar.bz2
rails-245017765644745b0e550ceaf815ea4e73a12681.zip
Added test for empty CDATA bug in from_xml
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index 012b956d7f..20b1362bcf 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -897,7 +897,13 @@ class HashToXmlTest < Test::Unit::TestCase
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 @@ class HashToXmlTest < Test::Unit::TestCase
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]