Skip to content

Commit

Permalink
Add spec for Enumerator.new form calling bare each.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius authored and eregon committed Jun 5, 2015
1 parent f2d4242 commit aa55755
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions shared/enumerator/each.rb
Expand Up @@ -9,6 +9,8 @@ def object_each_with_arguments.each_with_arguments(arg, *args)
end

@enum_with_arguments = object_each_with_arguments.to_enum(:each_with_arguments, :arg0, :arg1, :arg2)

@enum_with_yielder = Enumerator.new {|y| y.yield :ok}
end

it "yields each element of self to the given block" do
Expand Down Expand Up @@ -53,6 +55,8 @@ def object_each_with_arguments.each_with_arguments(arg, *args)

it "returns self if not given arguments and not given a block" do
@enum_with_arguments.each.should equal(@enum_with_arguments)

@enum_with_yielder.each.should equal(@enum_with_yielder)
end

it "returns the same value from receiver.each if block is given" do
Expand Down

0 comments on commit aa55755

Please sign in to comment.