From a0e78f7442143c1366de06ec28342ad728870a1c Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 16 Apr 2007 22:17:59 +0000 Subject: Fixed that parameters from XML should also be presented in a hash with indifferent access [DHH] Hash#with_indifferent_access now also converts hashes kept in arrays to indifferent access (makes it easier to treat HTML and XML parameters the same) [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6532 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/test/core_ext/hash_ext_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 5a5bd7fe5a..63caed7d99 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -183,6 +183,11 @@ class HashExtTest < Test::Unit::TestCase assert_equal '1234', roundtrip.default end + def test_indifferent_hash_with_array_of_hashes + hash = { "urls" => { "url" => [ { "address" => "1" }, { "address" => "2" } ] }}.with_indifferent_access + assert_equal "1", hash[:urls][:url].first[:address] + end + def test_stringify_and_symbolize_keys_on_indifferent_preserves_hash h = HashWithIndifferentAccess.new h[:first] = 1 -- cgit v1.2.3