aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2013-05-15 19:59:02 +0900
committerkennyj <kennyj@gmail.com>2013-05-16 00:08:58 +0900
commitf9c82f586cd73d9124d0fd89f9070e640a49adac (patch)
treef20527deb7fb1d8fc4535c88d253b7c2157d8f23 /activesupport/test
parent877920ba55d99eac1d68859f4f83d626645afa3e (diff)
downloadrails-f9c82f586cd73d9124d0fd89f9070e640a49adac.tar.gz
rails-f9c82f586cd73d9124d0fd89f9070e640a49adac.tar.bz2
rails-f9c82f586cd73d9124d0fd89f9070e640a49adac.zip
Fix HWIA#to_hash behavior with array of hashes.
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index b385e806bc..dfcc6cd12a 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -506,6 +506,11 @@ class HashExtTest < ActiveSupport::TestCase
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]
+
+ hash = hash.to_hash
+ assert_not hash.instance_of?(HashWithIndifferentAccess)
+ assert_not hash["urls"].instance_of?(HashWithIndifferentAccess)
+ assert_not hash["urls"]["url"].first.instance_of?(HashWithIndifferentAccess)
end
def test_should_preserve_array_subclass_when_value_is_array