summaryrefslogtreecommitdiff
path: root/spec/ruby/core/enumerator/lazy/chunk_while_spec.rb
blob: 772bd42de9117ab35e1ff5ab7d6f159080a848f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require_relative '../../../spec_helper'

describe "Enumerator::Lazy#chunk_while" do
  it "works with an infinite enumerable" do
    s = 0..Float::INFINITY
    s.lazy.chunk_while { |a, b| false }.first(100).should ==
      s.first(100).chunk_while { |a, b| false }.to_a
  end

  it "should return a lazy enumerator" do
    s = 0..Float::INFINITY
    s.lazy.chunk_while { |a, b| false }.should be_kind_of(Enumerator::Lazy)
  end
end