2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../spec_helper'
|
|
|
|
require_relative 'fixtures/classes'
|
2020-10-24 09:52:37 -04:00
|
|
|
require_relative '../../shared/enumerable/minmax'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
|
|
|
describe "Enumerable#minmax" do
|
|
|
|
before :each do
|
|
|
|
@enum = EnumerableSpecs::Numerous.new(6, 4, 5, 10, 8)
|
2020-10-24 09:52:37 -04:00
|
|
|
@empty_enum = EnumerableSpecs::Empty.new
|
|
|
|
@incomparable_enum = EnumerableSpecs::Numerous.new(BasicObject.new, BasicObject.new)
|
|
|
|
@incompatible_enum = EnumerableSpecs::Numerous.new(11,"22")
|
2017-05-07 08:04:49 -04:00
|
|
|
@strs = EnumerableSpecs::Numerous.new("333", "2", "60", "55555", "1010", "111")
|
|
|
|
end
|
|
|
|
|
2020-10-24 09:52:37 -04:00
|
|
|
it_behaves_like :enumerable_minmax, :minmax
|
2017-05-07 08:04:49 -04:00
|
|
|
|
|
|
|
it "gathers whole arrays as elements when each yields multiple" do
|
|
|
|
multi = EnumerableSpecs::YieldsMulti.new
|
|
|
|
multi.minmax.should == [[1, 2], [6, 7, 8, 9]]
|
|
|
|
end
|
|
|
|
end
|