Skip to content
Browse files

Added spec for 1.8 behavior of Enumerator#next

  • Loading branch information...
1 parent fedd69b commit 031e7c17f554f1e71df5b40ea0e0a71618c4dced @jtdowney jtdowney committed Oct 22, 2011
Showing with 8 additions and 0 deletions.
  1. +8 −0 spec/ruby/shared/enumerator/next.rb
View
8 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 031e7c1

Please sign in to comment.
Something went wrong with that request. Please try again.