aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/array
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2019-03-05 16:04:41 -0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2019-03-05 16:04:41 -0800
commitbfaa3091c3c32b5980a614ef0f7b39cbf83f6db3 (patch)
tree040de4c20837ba49faf87ac9f7251f4df0afb9af /activesupport/test/core_ext/array
parent91ed21b304c468db8ce9fd830312c151432935d0 (diff)
downloadrails-bfaa3091c3c32b5980a614ef0f7b39cbf83f6db3.tar.gz
rails-bfaa3091c3c32b5980a614ef0f7b39cbf83f6db3.tar.bz2
rails-bfaa3091c3c32b5980a614ef0f7b39cbf83f6db3.zip
Added Array#including, Array#excluding, Enumerable#including, Enumerable#excluding
Diffstat (limited to 'activesupport/test/core_ext/array')
-rw-r--r--activesupport/test/core_ext/array/access_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/array/access_test.rb b/activesupport/test/core_ext/array/access_test.rb
index 8c217023cf..8f89c3f25c 100644
--- a/activesupport/test/core_ext/array/access_test.rb
+++ b/activesupport/test/core_ext/array/access_test.rb
@@ -32,6 +32,16 @@ class AccessTest < ActiveSupport::TestCase
assert_equal array[-2], array.second_to_last
end
+ def test_including
+ assert_equal [1, 2, 3, 4, 5], [1, 2, 4].including(3, 5).sort
+ assert_equal [1, 2, 3, 4, 5], [1, 2, 4].including([3, 5]).sort
+ end
+
+ def test_excluding
+ assert_equal [1, 2, 4], [1, 2, 3, 4, 5].excluding(3, 5)
+ assert_equal [1, 2, 4], [1, 2, 3, 4, 5].excluding([3, 5])
+ end
+
def test_without
assert_equal [1, 2, 4], [1, 2, 3, 4, 5].without(3, 5)
end