From d80afed620dde5b9356c883ae187db2332d4c18e Mon Sep 17 00:00:00 2001 From: Andrea Campi Date: Sat, 9 Oct 2010 19:28:43 +0200 Subject: Override #store to be consistent with #[]. [#5775 state:resolved] Signed-off-by: Santiago Pastorino --- activesupport/test/core_ext/hash_ext_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activesupport/test/core_ext/hash_ext_test.rb') diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 0f35eb9e78..545fed2684 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -316,6 +316,16 @@ class HashExtTest < Test::Unit::TestCase assert_equal expected, hash_1 end + def test_store_on_indifferent_access + hash = HashWithIndifferentAccess.new + hash.store(:test1, 1) + hash.store('test1', 11) + hash[:test2] = 2 + hash['test2'] = 22 + expected = { "test1" => 11, "test2" => 22 } + assert_equal expected, hash + end + def test_reverse_merge defaults = { :a => "x", :b => "y", :c => 10 }.freeze options = { :a => 1, :b => 2 } -- cgit v1.2.3