summaryrefslogtreecommitdiff
path: root/spec/ruby/core/array
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/array')
-rw-r--r--spec/ruby/core/array/intersect_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/ruby/core/array/intersect_spec.rb b/spec/ruby/core/array/intersect_spec.rb
new file mode 100644
index 0000000000..b8c5b1e69a
--- /dev/null
+++ b/spec/ruby/core/array/intersect_spec.rb
@@ -0,0 +1,17 @@
+require_relative '../../spec_helper'
+
+describe 'Array#intersect?' do
+ ruby_version_is '3.1' do # https://bugs.ruby-lang.org/issues/15198
+ describe 'when at least one element in two Arrays is the same' do
+ it 'returns true' do
+ [1, 2].intersect?([2, 3]).should == true
+ end
+ end
+
+ describe 'when there are no elements in common between two Arrays' do
+ it 'returns false' do
+ [1, 2].intersect?([3, 4]).should == false
+ end
+ end
+ end
+end