File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
lib/active_support/core_ext/hash Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ def unrename_keys(params)
221
221
case params . class . to_s
222
222
when "Hash"
223
223
params . inject ( { } ) do |h , ( k , v ) |
224
- h [ k . to_s . underscore . tr ( "-" , "_" ) ] = unrename_keys ( v )
224
+ h [ k . to_s . tr ( "-" , "_" ) ] = unrename_keys ( v )
225
225
h
226
226
end
227
227
when "Array"
Original file line number Diff line number Diff line change @@ -654,6 +654,22 @@ def test_empty_array_from_xml
654
654
assert_equal expected_blog_hash , Hash . from_xml ( blog_xml )
655
655
end
656
656
657
+ def test_all_caps_key_from_xml
658
+ test_xml = <<-EOT
659
+ <ABC3XYZ>
660
+ <TEST>Lorem Ipsum</TEST>
661
+ </ABC3XYZ>
662
+ EOT
663
+
664
+ expected_hash = {
665
+ "ABC3XYZ" => {
666
+ "TEST" => "Lorem Ipsum"
667
+ }
668
+ }
669
+
670
+ assert_equal expected_hash , Hash . from_xml ( test_xml )
671
+ end
672
+
657
673
def test_empty_array_with_whitespace_from_xml
658
674
blog_xml = <<-XML
659
675
<blog>
You can’t perform that action at this time.
0 commit comments