diff options
author | José Valim <jose.valim@gmail.com> | 2010-11-26 11:55:56 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-11-26 11:56:52 +0100 |
commit | ce9456eca0c4ea77a42aaad5e8080842c1c01422 (patch) | |
tree | e9ce376e848e1be07060cc4e8430a2f9cd7bded9 /activesupport/test/core_ext | |
parent | 9332cc582ebaa9b6755fa7bdfe0bc04dd51c098d (diff) | |
download | rails-ce9456eca0c4ea77a42aaad5e8080842c1c01422.tar.gz rails-ce9456eca0c4ea77a42aaad5e8080842c1c01422.tar.bz2 rails-ce9456eca0c4ea77a42aaad5e8080842c1c01422.zip |
Only convert direct hash instances in hash with indifferent access.
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 370f26b0d7..74223dd7f2 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -12,6 +12,9 @@ class HashExtTest < Test::Unit::TestCase class SubclassingArray < Array end + class SubclassingHash < Hash + end + def setup @strings = { 'a' => 1, 'b' => 2 } @symbols = { :a => 1, :b => 2 } @@ -105,6 +108,11 @@ class HashExtTest < Test::Unit::TestCase assert_equal @strings, @mixed.with_indifferent_access.dup.stringify_keys! end + def test_hash_subclass + flash = { "foo" => SubclassingHash.new.tap { |h| h["bar"] = "baz" } }.with_indifferent_access + assert_kind_of SubclassingHash, flash["foo"] + end + def test_indifferent_assorted @strings = @strings.with_indifferent_access @symbols = @symbols.with_indifferent_access |