Permalink
Browse files

Merge pull request #1344 from jtdowney/new-enumerator-next-spec

Added spec for 1.8 behavior of Enumerator#next
  • Loading branch information...
2 parents 019f146 + 031e7c1 commit 7d79a58847bd1e2a22a1cdcdcb0d873850297bb6 @rue rue committed Oct 23, 2011
Showing with 8 additions and 0 deletions.
  1. +8 −0 spec/ruby/shared/enumerator/next.rb
@@ -17,6 +17,14 @@
lambda { @enum.next }.should raise_error(StopIteration)
end
+ ruby_version_is ""..."1.9" do
+ it "is rewound after encountering a StopIteration" do
+ 3.times { @enum.next }
+ lambda { @enum.next }.should raise_error(StopIteration)
+ @enum.next.should == 1
+ end
+ end
+
ruby_version_is "1.9" do
it "cannot be called again until the enumerator is rewound" do
3.times { @enum.next }

0 comments on commit 7d79a58

Please sign in to comment.