Created
February 25, 2010 21:35
-
-
Save kronos/315062 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/spec/ruby/core/array/cycle_spec.rb b/spec/ruby/core/array/cycle_spec.rb | |
index fd1e0f2..491e177 100644 | |
--- a/spec/ruby/core/array/cycle_spec.rb | |
+++ b/spec/ruby/core/array/cycle_spec.rb | |
@@ -17,5 +17,13 @@ describe "Enumerable#cycle" do | |
end.should == 42 | |
bomb.should == 0 | |
end | |
+ | |
+ it "yields successive elements of the array repeatedly" do | |
+ b = [] | |
+ [1,2,3].cycle do |elem| | |
+ b << elem | |
+ break if b.size == 7 | |
+ end | |
+ b.should == [1,2,3,1,2,3,1] | |
+ end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment