aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2006-05-14 18:17:30 +0000
committerMarcel Molina <marcel@vernix.org>2006-05-14 18:17:30 +0000
commitf2b3deb85cab1389d6b895b2e45b33054a96a6ba (patch)
tree1b31f8191a3ac838d0bdf462f3184527bdeea1ee /activesupport/test
parentf9f65433efa18969b81ec1a8ab8d74d01bfd464e (diff)
downloadrails-f2b3deb85cab1389d6b895b2e45b33054a96a6ba.tar.gz
rails-f2b3deb85cab1389d6b895b2e45b33054a96a6ba.tar.bz2
rails-f2b3deb85cab1389d6b895b2e45b33054a96a6ba.zip
Don't destroy a HashWithIndifferentAccess if symbolize_keys! or stringify_keys! is called on it. Closes #5076. [Marcel Molina Jr., guy.naor@famundo.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4339 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index 3fc3b86254..a12299d32c 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -145,6 +145,17 @@ class HashExtTest < Test::Unit::TestCase
assert_equal hash.delete('a'), nil
end
+ def test_stringify_and_symbolize_keys_on_indifferent_preserves_hash
+ h = HashWithIndifferentAccess.new
+ h[:first] = 1
+ h.stringify_keys!
+ assert_equal 1, h['first']
+ h = HashWithIndifferentAccess.new
+ h['first'] = 1
+ h.symbolize_keys!
+ assert_equal 1, h[:first]
+ end
+
def test_assert_valid_keys
assert_nothing_raised do
{ :failure => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ])