diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-11-25 21:58:24 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-11-25 21:58:24 +0000 |
commit | 4d96ece6ecd27fb6d3695f2503d00ba3d1a9d7ee (patch) | |
tree | 67aad129bc728765a01bbe0ff014c17f75a564f4 /activesupport/test/core_ext | |
parent | ccebac9d1f1debdd20228dded6c2ba5376eb6c87 (diff) | |
download | rails-4d96ece6ecd27fb6d3695f2503d00ba3d1a9d7ee.tar.gz rails-4d96ece6ecd27fb6d3695f2503d00ba3d1a9d7ee.tar.bz2 rails-4d96ece6ecd27fb6d3695f2503d00ba3d1a9d7ee.zip |
Fix that empty collections should be treated as empty arrays regardless of whitespace for Hash#from_xml (closes #10255) [adamj]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8202 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index fe728919cd..2be9ab8999 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -549,6 +549,17 @@ class HashToXmlTest < Test::Unit::TestCase assert_equal expected_blog_hash, Hash.from_xml(blog_xml) end + def test_empty_array_with_whitespace_from_xml + blog_xml = <<-XML + <blog> + <posts type="array"> + </posts> + </blog> + XML + expected_blog_hash = {"blog" => {"posts" => []}} + assert_equal expected_blog_hash, Hash.from_xml(blog_xml) + end + def test_array_with_one_entry_from_xml blog_xml = <<-XML <blog> |