aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/hash_ext_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-11-25 21:58:24 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-11-25 21:58:24 +0000
commit4d96ece6ecd27fb6d3695f2503d00ba3d1a9d7ee (patch)
tree67aad129bc728765a01bbe0ff014c17f75a564f4 /activesupport/test/core_ext/hash_ext_test.rb
parentccebac9d1f1debdd20228dded6c2ba5376eb6c87 (diff)
downloadrails-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/hash_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb11
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>