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

describe "Enumerator::Lazy#slice_before" do
  it "works with an infinite enumerable" do
    s = 0..Float::INFINITY
    s.lazy.slice_before { |n| true }.first(100).should ==
      s.first(100).slice_before { |n| true }.to_a
  end

  it "should return a lazy enumerator" do
    s = 0..Float::INFINITY
    s.lazy.slice_before { |n| true }.should be_kind_of(Enumerator::Lazy)
  end
end