Sha256: a34819ebb38e1f8be8c8afa9dd687012f601077dae8cf846a586e3289f29e29e
Contents?: true
Size: 1.31 KB
Versions: 4
Compression:
Stored size: 1.31 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'hamster/list' describe Hamster::List do [:each, :foreach].each do |method| describe "##{method}" do describe "on a really big list" do before do @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) end it "doesn't run out of stack" do lambda { @list.send(method) { |item| } }.should_not raise_error end end [ [], ["A"], ["A", "B", "C"], ].each do |values| describe "on #{values.inspect}" do before do @original = Hamster.list(*values) end describe "with a block" do before do @items = [] @result = @original.send(method) { |item| @items << item } end it "iterates over the items in order" do @items.should == values end it "returns nil" do @result.should be_nil end end describe "without a block" do before do @result = @original.send(method) end it "returns self" do @result.should equal(@original) end end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.2.5 | spec/hamster/list/each_spec.rb |
hamster-0.2.4 | spec/hamster/list/each_spec.rb |
hamster-0.2.3 | spec/hamster/list/each_spec.rb |
hamster-0.2.2 | spec/hamster/list/each_spec.rb |