Skip to content

Instantly share code, notes, and snippets.

@kronos
Created February 25, 2010 21:35
Show Gist options
  • Save kronos/315062 to your computer and use it in GitHub Desktop.
Save kronos/315062 to your computer and use it in GitHub Desktop.
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