aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2011-04-14 16:25:08 +0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2011-04-14 16:33:41 +0800
commit7660e7cb4df69ad127661ad87f495a3b212170b9 (patch)
treef31be8968db5a9385eeccda24476d66338acfdd7 /activesupport/test
parentada550d9088be9845ff8e4dbe0f27e574c5fc62b (diff)
downloadrails-7660e7cb4df69ad127661ad87f495a3b212170b9.tar.gz
rails-7660e7cb4df69ad127661ad87f495a3b212170b9.tar.bz2
rails-7660e7cb4df69ad127661ad87f495a3b212170b9.zip
attributes no longer disappear if a tag contains whitespace
old: Hash.from_xml("<tag foo='bar'>\n</tag>") => {"tag"=>"\n"} new: Hash.from_xml("<tag foo='bar'>\n</tag>") => {"tag"=>{"foo"=>"bar", "__content__"=>"\n"}
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index a0479d45ac..012b956d7f 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -889,6 +889,15 @@ class HashToXmlTest < Test::Unit::TestCase
assert_equal 'application/octet-stream', file.content_type
end
+ def test_tag_with_attrs_and_whitespace
+ xml = <<-XML
+ <blog name="bacon is the best">
+ </blog>
+ XML
+ hash = Hash.from_xml(xml)
+ assert_equal "bacon is the best", hash['blog']['name']
+ end
+
def test_xsd_like_types_from_xml
bacon_xml = <<-EOT
<bacon>