Permalink
Browse files

Adds failed test case for slicing hash with indifferent access with s…

…ymbol keys

Signed-off-by: Michael Koziarski <michael@koziarski.com>
  • Loading branch information...
1 parent a4f2ba8 commit c452e49e763e3b7018f2cb550d318b2851703985 adam committed with NZKoz Sep 23, 2008
Showing with 10 additions and 0 deletions.
  1. +10 −0 activesupport/test/core_ext/hash_ext_test.rb
View
10 activesupport/test/core_ext/hash_ext_test.rb
@@ -329,6 +329,16 @@ def test_indifferent_slice
end
end
+ def test_indifferent_slice_access_with_symbols
+ original = {'login' => 'bender', 'password' => 'shiny', 'stuff' => 'foo'}
+ original = original.with_indifferent_access
+
+ slice = original.slice(:login, :password)
+
+ assert_equal 'bender', slice[:login]
+ assert_equal 'bender', slice['login']
+ end
+
def test_except
original = { :a => 'x', :b => 'y', :c => 10 }
expected = { :a => 'x', :b => 'y' }

0 comments on commit c452e49

Please sign in to comment.