Skip to content

Commit fde8109

Browse files
sampatbadheeregon
authored andcommitted
Add spec for Array#intersect?
1 parent b3f9da9 commit fde8109

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

core/array/intersect_spec.rb

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require_relative '../../spec_helper'
2+
3+
describe 'Array#intersect?' do
4+
ruby_version_is '3.1' do # https://bugs.ruby-lang.org/issues/15198
5+
describe 'when at least one element in two Arrays is the same' do
6+
it 'returns true' do
7+
[1, 2].intersect?([2, 3]).should == true
8+
end
9+
end
10+
11+
describe 'when there are no elements in common between two Arrays' do
12+
it 'returns false' do
13+
[1, 2].intersect?([3, 4]).should == false
14+
end
15+
end
16+
end
17+
end

0 commit comments

Comments
 (0)