diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-06-20 11:31:06 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-06-20 11:31:06 -0500 |
commit | 161ab28b7c0bd28828b6d18613a9de09d47023c6 (patch) | |
tree | e66809696a44b505b2f1e379f54adbbf67930300 /activesupport/test | |
parent | 00ba4c0cf32f9417d47bd891eba97f2e04609520 (diff) | |
download | rails-161ab28b7c0bd28828b6d18613a9de09d47023c6.tar.gz rails-161ab28b7c0bd28828b6d18613a9de09d47023c6.tar.bz2 rails-161ab28b7c0bd28828b6d18613a9de09d47023c6.zip |
Added block-handling to Enumerable#many? (Damian Janowski) [#452 state:resolved]
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/enumerable_test.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index fb9b9b8916..2315d8f3db 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -63,10 +63,15 @@ class EnumerableTests < Test::Unit::TestCase assert_equal({ 5 => payments[0], 15 => payments[1], 10 => payments[2] }, payments.index_by { |p| p.price }) end - - def test_several + + def test_many assert ![].many? assert ![ 1 ].many? assert [ 1, 2 ].many? + + assert ![].many? {|x| x > 1 } + assert ![ 2 ].many? {|x| x > 1 } + assert ![ 1, 2 ].many? {|x| x > 1 } + assert [ 1, 2, 2 ].many? {|x| x > 1 } end end |