diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-07 02:58:16 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-07 02:58:16 -0700 |
commit | a6ef255ff57519c174c87f45cb4c1d040050a364 (patch) | |
tree | ead83926f0712dd34a2ac29c8bdfcba24d1a47f0 /activesupport/test | |
parent | c515f64f72d070b9481ab8b62c98aaae45b96323 (diff) | |
parent | aba149d702e4dcd999ce1b71688ec15b0c637875 (diff) | |
download | rails-a6ef255ff57519c174c87f45cb4c1d040050a364.tar.gz rails-a6ef255ff57519c174c87f45cb4c1d040050a364.tar.bz2 rails-a6ef255ff57519c174c87f45cb4c1d040050a364.zip |
Merge pull request #349 from bradley178/master
Hash.from_xml chokes on empty CDATA
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 10 |
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..3ef080e1cb 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 = "<data><![CDATA[]]></data>" + + assert_equal "", Hash.from_xml(xml)["data"] + 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] |