diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-18 04:01:44 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-18 04:01:44 +0000 |
commit | 504ab568f8941b4ecec5026c06743920bcb05c37 (patch) | |
tree | 59d1e709da354d3218ac39cbfc2fe279739c00fb /activesupport/test/core_ext | |
parent | 0555fc905c09d4339bfb641428a4ddfcb5f4c0c6 (diff) | |
download | rails-504ab568f8941b4ecec5026c06743920bcb05c37.tar.gz rails-504ab568f8941b4ecec5026c06743920bcb05c37.tar.bz2 rails-504ab568f8941b4ecec5026c06743920bcb05c37.zip |
Fixed HashWithIndifferentAccess#delete to work with both symbols and strings (closes #2176) [Caio Chassot]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3912 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 43b0b29216..a11cef6fc4 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -135,6 +135,16 @@ class HashExtTest < Test::Unit::TestCase assert_equal 2, hash['b'] end + def test_indifferent_deleting + get_hash = proc{ { :a => 'foo' }.with_indifferent_access } + hash = get_hash.call + assert_equal hash.delete(:a), 'foo' + assert_equal hash.delete(:a), nil + hash = get_hash.call + assert_equal hash.delete('a'), 'foo' + assert_equal hash.delete('a'), nil + end + def test_assert_valid_keys assert_nothing_raised do { :failure => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ]) |