diff options
author | Rick Olson <technoweenie@gmail.com> | 2007-12-08 00:12:52 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2007-12-08 00:12:52 +0000 |
commit | 4dcd4069f577e2105ea25929be1350fcefb9f71d (patch) | |
tree | 6501ef68e3c7594580620e8fc6a182507d8350ff /activesupport/test | |
parent | 1acd54a5b44639ecb0bd0e37545a2e862df2b9a7 (diff) | |
download | rails-4dcd4069f577e2105ea25929be1350fcefb9f71d.tar.gz rails-4dcd4069f577e2105ea25929be1350fcefb9f71d.tar.bz2 rails-4dcd4069f577e2105ea25929be1350fcefb9f71d.zip |
Fix HashWithIndifferentAccess#to_options! so it doesn't clear the options hash. Closes #10419 [ReinH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8332 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 2be9ab8999..3763f47c68 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -205,6 +205,14 @@ class HashExtTest < Test::Unit::TestCase assert_equal 1, h[:first] end + def test_to_options_on_indifferent_preserves_hash + h = HashWithIndifferentAccess.new + h['first'] = 1 + h.to_options! + assert_equal 1, h['first'] + end + + def test_indifferent_subhashes h = {'user' => {'id' => 5}}.with_indifferent_access ['user', :user].each {|user| [:id, 'id'].each {|id| assert_equal 5, h[user][id], "h[#{user.inspect}][#{id.inspect}] should be 5"}} |