diff options
author | Vasiliy Ermolovich <younash@gmail.com> | 2012-03-05 21:35:57 +0300 |
---|---|---|
committer | Vasiliy Ermolovich <younash@gmail.com> | 2012-03-06 08:33:14 +0300 |
commit | 74cb4b63bdbf34202f77ba17bcd15374a4900b03 (patch) | |
tree | 820664f01b23863b82bf1c6077f19911c020c2f7 /activesupport/test | |
parent | c5a47b3207de8db12cfe956fd75933b6930395b2 (diff) | |
download | rails-74cb4b63bdbf34202f77ba17bcd15374a4900b03.tar.gz rails-74cb4b63bdbf34202f77ba17bcd15374a4900b03.tar.bz2 rails-74cb4b63bdbf34202f77ba17bcd15374a4900b03.zip |
refactor Hash#slice and Hash#extract!
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 38cdda6c5c..d71e3f968f 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -486,6 +486,13 @@ class HashExtTest < ActiveSupport::TestCase assert_equal 'bender', slice['login'] end + def test_extract + original = {:a => 1, :b => 2, :c => 3, :d => 4} + expected = {:a => 1, :b => 2} + + assert_equal expected, {:a => 1, :b => 2, :c => 3, :d => 4}.extract!(:a, :b) + end + def test_except original = { :a => 'x', :b => 'y', :c => 10 } expected = { :a => 'x', :b => 'y' } |