Skip to content

Commit

Permalink
Add a Enumerator::Lazy#{to_enum,enum_for} spec
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Sep 3, 2013
1 parent a5cb326 commit 0312872
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/ruby/core/enumerator/lazy/shared/to_enum.rb
Expand Up @@ -25,6 +25,10 @@
enumerator_class::Lazy.new(Object.new, 100) {}.send(@method) { 30 }.size.should == 30
end

it "generates a lazy enumerator from the given name" do
@infinite.send(@method, :with_index, 10).first(3).should == [[0, 10], [1, 11], [2, 12]]
end

it "passes given arguments to wrapped method" do
@infinite.send(@method, :each_slice, 2).map { |assoc| assoc.first * assoc.last }.first(4).should == [0, 6, 20, 42]
end
Expand Down

0 comments on commit 0312872

Please sign in to comment.