aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-05-04 19:23:34 -0300
committerEmilio Tagua <miloops@gmail.com>2009-05-04 19:23:34 -0300
commitd3042ef80c4406c90ff1e120059a99784d8ae79f (patch)
treea779b4fced3fd546d7c7c855fee41f3d996afba0 /activesupport
parentd522b7ccf61a71b4c66ddf39368513d1fd9cd577 (diff)
parenteb201e64c0b68aee6d0715d44cf48178204c4133 (diff)
downloadrails-d3042ef80c4406c90ff1e120059a99784d8ae79f.tar.gz
rails-d3042ef80c4406c90ff1e120059a99784d8ae79f.tar.bz2
rails-d3042ef80c4406c90ff1e120059a99784d8ae79f.zip
Merge commit 'rails/master'
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/conversions.rb2
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb16
2 files changed, 17 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb
index f9dddec687..fe1f79050c 100644
--- a/activesupport/lib/active_support/core_ext/hash/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb
@@ -217,7 +217,7 @@ class Hash
case params.class.to_s
when "Hash"
params.inject({}) do |h,(k,v)|
- h[k.to_s.underscore.tr("-", "_")] = unrename_keys(v)
+ h[k.to_s.tr("-", "_")] = unrename_keys(v)
h
end
when "Array"
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index d65a5323bf..ece5466abb 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -646,6 +646,22 @@ class HashToXmlTest < Test::Unit::TestCase
assert_equal expected_topic_hash, Hash.from_xml(topic_xml)["rsp"]["photos"]["photo"]
end
+ def test_all_caps_key_from_xml
+ test_xml = <<-EOT
+ <ABC3XYZ>
+ <TEST>Lorem Ipsum</TEST>
+ </ABC3XYZ>
+ EOT
+
+ expected_hash = {
+ "ABC3XYZ" => {
+ "TEST" => "Lorem Ipsum"
+ }
+ }
+
+ assert_equal expected_hash, Hash.from_xml(test_xml)
+ end
+
def test_empty_array_from_xml
blog_xml = <<-XML
<blog>