diff options
author | Damian Janowski <damian.janowski@gmail.com> | 2008-11-18 18:53:06 -0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-11-19 10:48:41 +0100 |
commit | f451f0e5cfa358e88ac9d03d813a9c84facd6648 (patch) | |
tree | 1b5f2831b934d92f21a8f5ab16ed536ee5e90dc8 /activesupport/test/core_ext | |
parent | 917428bcce7bb22241bfc07daa5d0ddf9d107775 (diff) | |
download | rails-f451f0e5cfa358e88ac9d03d813a9c84facd6648.tar.gz rails-f451f0e5cfa358e88ac9d03d813a9c84facd6648.tar.bz2 rails-f451f0e5cfa358e88ac9d03d813a9c84facd6648.zip |
Added Enumerable#none? to check that none of the elements match the block [#1408 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/enumerable_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index deb9b7544d..288ce14b2c 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -79,4 +79,14 @@ class EnumerableTests < Test::Unit::TestCase assert ![ 1, 2 ].many? {|x| x > 1 } assert [ 1, 2, 2 ].many? {|x| x > 1 } end + + def test_none + assert [].none? + assert [ 1 ].none? + + assert [].none? {|x| x > 1 } + assert ![ 2 ].none? {|x| x > 1 } + assert ![ 1, 2 ].none? {|x| x > 1 } + assert [ 1, 1 ].none? {|x| x > 1 } + end end |