diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-12 20:10:10 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-12 20:10:10 +0000 |
commit | 83c3f6f81a4dbb618518aac9e411cd1f675fe571 (patch) | |
tree | e0cfc508a0fdea21116f4bfb319f3f43948ab5e3 /activesupport/test/core_ext | |
parent | 61a6a440cb8bc4694828c437fb1996db270c9ee6 (diff) | |
download | rails-83c3f6f81a4dbb618518aac9e411cd1f675fe571.tar.gz rails-83c3f6f81a4dbb618518aac9e411cd1f675fe571.tar.bz2 rails-83c3f6f81a4dbb618518aac9e411cd1f675fe571.zip |
Added Hash#stringify_keys and Hash#stringify_keys!
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@586 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index de85db2edf..14f2b901b4 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -12,6 +12,8 @@ class HashExtTest < Test::Unit::TestCase h = {} assert_respond_to h, :symbolize_keys assert_respond_to h, :symbolize_keys! + assert_respond_to h, :stringify_keys + assert_respond_to h, :stringify_keys! assert_respond_to h, :to_options assert_respond_to h, :to_options! end @@ -32,6 +34,18 @@ class HashExtTest < Test::Unit::TestCase assert_raises(NoMethodError) { { [] => 1 }.symbolize_keys! } end + def test_stringify_keys + assert_equal @strings, @symbols.stringify_keys + assert_equal @strings, @strings.stringify_keys + assert_equal @strings, @mixed.stringify_keys + end + + def test_stringify_keys! + assert_equal @strings, @symbols.dup.stringify_keys! + assert_equal @strings, @strings.dup.stringify_keys! + assert_equal @strings, @mixed.dup.stringify_keys! + end + def test_indifferent_access @strings = @strings.with_indifferent_access @symbols = @symbols.with_indifferent_access |