diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2009-12-14 18:00:14 -0800 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2009-12-14 18:00:14 -0800 |
commit | 7b61541ea53c309847753d5553baa2eed9cc6282 (patch) | |
tree | 2440938485241d03c37757768987a76490376afd /activesupport/test/core_ext | |
parent | 5f8e48cbd297aca4add4b48efa2136ba6ac851b1 (diff) | |
download | rails-7b61541ea53c309847753d5553baa2eed9cc6282.tar.gz rails-7b61541ea53c309847753d5553baa2eed9cc6282.tar.bz2 rails-7b61541ea53c309847753d5553baa2eed9cc6282.zip |
Add Enumerable#exclude? to bring parity to Enumerable#include? and avoid if !x.include?/else calls [DHH]
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/enumerable_test.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index 66f5f9fbde..4650b796b6 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -89,4 +89,9 @@ class EnumerableTests < Test::Unit::TestCase assert ![ 1, 2 ].many? {|x| x > 1 } assert [ 1, 2, 2 ].many? {|x| x > 1 } end + + def test_exclude? + assert [ 1 ].exclude?(2) + assert ![ 1 ].exclude?(1) + end end |