From 504ab568f8941b4ecec5026c06743920bcb05c37 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 18 Mar 2006 04:01:44 +0000 Subject: 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 --- activesupport/test/core_ext/hash_ext_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activesupport/test/core_ext') 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 ]) -- cgit v1.2.3