diff options
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 52a28c1553..de85db2edf 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -2,7 +2,6 @@ require 'test/unit' require File.dirname(__FILE__) + '/../../lib/core_ext/hash' class HashExtTest < Test::Unit::TestCase - def setup @strings = { 'a' => 1, 'b' => 2 } @symbols = { :a => 1, :b => 2 } @@ -33,6 +32,17 @@ class HashExtTest < Test::Unit::TestCase assert_raises(NoMethodError) { { [] => 1 }.symbolize_keys! } end + def test_indifferent_access + @strings = @strings.with_indifferent_access + @symbols = @symbols.with_indifferent_access + @mixed = @mixed.with_indifferent_access + + assert_equal @strings[:a], @strings["a"] + assert_equal @symbols[:a], @symbols["a"] + assert_equal @strings["b"], @mixed["b"] + assert_equal @strings[:b], @mixed["b"] + end + def test_assert_valid_keys assert_nothing_raised do { :failure => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ]) |