Permalink
Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
44 lines (33 sloc) 824 Bytes
require "spec_helper"
describe Array do
describe "#each" do
let(:array) do
(1...100).map do
stub.tap do |s|
s.expects(:executed).once
end
end
end
context "when providing a block" do
context "when passed a threshold" do
it "iterates over each of the elements" do
array.forked(10).each do |element|
element.executed
end
end
end
context "when no threshold is passed" do
it "iterates over each of the elements" do
array.forked.each do |element|
element.executed
end
end
end
end
context "when no block is provided" do
it "returns the standard enumerator" do
[].forked.each.should be_a(Enumerator)
end
end
end
end