From 187e1f85d0c871ba61e5bc3651a7ec2f657db8f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=BCtke?= Date: Mon, 9 Jul 2007 22:07:39 +0000 Subject: Support for non heterogeneous arrays when serializing to xml. Unless guessable from array name the type name will be included as attribute git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7173 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/test/core_ext/hash_ext_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index c2b7a7f1eb..17bfb3a92c 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -588,6 +588,23 @@ class HashToXmlTest < Test::Unit::TestCase assert_equal expected_bacon_hash, Hash.from_xml(bacon_xml)["bacon"] end + + def test_type_trickles_through_when_unknown + product_xml = <<-EOT + + 0.5 + image.gif + + + EOT + + expected_product_hash = { + :weight => 0.5, + :image => {'type' => 'ProductImage', 'filename' => 'image.gif' }, + }.stringify_keys + + 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) -- cgit v1.2.3