Skip to content

Commit

Permalink
Add spec for return value of Enumerable#each_cons when a block is given
Browse files Browse the repository at this point in the history
  • Loading branch information
ytjmt authored and eregon committed Oct 8, 2022
1 parent df9ea91 commit acc0833
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/enumerable/each_cons_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
multi.each_cons(2).to_a.should == [[[1, 2], [3, 4, 5]], [[3, 4, 5], [6, 7, 8, 9]]]
end

ruby_version_is "3.1" do
it "returns self when a block is given" do
@enum.each_cons(3){}.should == @enum
end
end

describe "when no block is given" do
it "returns an enumerator" do
e = @enum.each_cons(3)
Expand Down

0 comments on commit acc0833

Please sign in to comment.