aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/hash_ext_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-10-16 18:56:13 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-10-16 18:56:13 +0000
commitcfffedb4d86bcf3190da5e6433b694fc2e9f1bd9 (patch)
treecb3fea4f87f93a3e7430a7da92eb071036e66a09 /activesupport/test/core_ext/hash_ext_test.rb
parenta2172e75f589f038ed10806e9a32be99d4d69f89 (diff)
downloadrails-cfffedb4d86bcf3190da5e6433b694fc2e9f1bd9.tar.gz
rails-cfffedb4d86bcf3190da5e6433b694fc2e9f1bd9.tar.bz2
rails-cfffedb4d86bcf3190da5e6433b694fc2e9f1bd9.zip
Hash#symbolize_keys behaves well with integer keys. Closes #9890.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7945 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext/hash_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index 5691ec7c1c..359eacaba3 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -5,6 +5,7 @@ class HashExtTest < Test::Unit::TestCase
@strings = { 'a' => 1, 'b' => 2 }
@symbols = { :a => 1, :b => 2 }
@mixed = { :a => 1, 'b' => 2 }
+ @fixnums = { 0 => 1, 1 => 2 }
end
def test_methods
@@ -33,6 +34,11 @@ class HashExtTest < Test::Unit::TestCase
assert_raises(NoMethodError) { { [] => 1 }.symbolize_keys }
end
+ def test_symbolize_keys_preserves_fixnum_keys
+ assert_equal @fixnums, @fixnums.symbolize_keys
+ assert_equal @fixnums, @fixnums.dup.symbolize_keys!
+ end
+
def test_stringify_keys
assert_equal @strings, @symbols.stringify_keys
assert_equal @strings, @strings.stringify_keys