Do not call the inplicit convercion spec on older ruby versions

This commit is contained in:
Tema Bolshakov 2023-11-28 13:35:38 +01:00 коммит произвёл Yusuke Endoh
Родитель 9c900771da
Коммит bed014e374
1 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -36,15 +36,17 @@ describe "Array#rassoc" do
[[1, :foobar, o], [2, o, 1], [3, mock('foo')]].rassoc(key).should == [2, o, 1]
end
it "calls to_ary on non-array elements" do
s1 = [1, 2]
s2 = ArraySpecs::ArrayConvertible.new(2, 3)
a = [s1, s2]
ruby_version_is "3.3" do
it "calls to_ary on non-array elements" do
s1 = [1, 2]
s2 = ArraySpecs::ArrayConvertible.new(2, 3)
a = [s1, s2]
s1.should_not_receive(:to_ary)
a.rassoc(2).should equal(s1)
s1.should_not_receive(:to_ary)
a.rassoc(2).should equal(s1)
a.rassoc(3).should == [2, 3]
s2.called.should equal(:to_ary)
a.rassoc(3).should == [2, 3]
s2.called.should equal(:to_ary)
end
end
end