diff options
Diffstat (limited to 'activesupport/test/hash_with_indifferent_access_test.rb')
-rw-r--r-- | activesupport/test/hash_with_indifferent_access_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/test/hash_with_indifferent_access_test.rb b/activesupport/test/hash_with_indifferent_access_test.rb index 41d653fa59..09f2598067 100644 --- a/activesupport/test/hash_with_indifferent_access_test.rb +++ b/activesupport/test/hash_with_indifferent_access_test.rb @@ -404,6 +404,12 @@ class HashWithIndifferentAccessTest < ActiveSupport::TestCase assert_equal({ "aa" => 1, "bb" => 2 }, hash) assert_instance_of ActiveSupport::HashWithIndifferentAccess, hash + + hash = ActiveSupport::HashWithIndifferentAccess.new(@strings).transform_keys { |k| k.to_sym } + + assert_equal(1, hash[:a]) + assert_equal(1, hash["a"]) + assert_instance_of ActiveSupport::HashWithIndifferentAccess, hash end def test_indifferent_transform_keys_bang @@ -412,6 +418,13 @@ class HashWithIndifferentAccessTest < ActiveSupport::TestCase assert_equal({ "aa" => 1, "bb" => 2 }, indifferent_strings) assert_instance_of ActiveSupport::HashWithIndifferentAccess, indifferent_strings + + indifferent_strings = ActiveSupport::HashWithIndifferentAccess.new(@strings) + indifferent_strings.transform_keys! { |k| k.to_sym } + + assert_equal(1, indifferent_strings[:a]) + assert_equal(1, indifferent_strings["a"]) + assert_instance_of ActiveSupport::HashWithIndifferentAccess, indifferent_strings end def test_indifferent_transform_values |