Sha256: b28ea77bbb6f1d63d075250937bd9dc95315799425874b83a807fe2b3404fcc6
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Hamster::List do [:map, :collect].each do |method| describe "##{method}" do describe "on a really big list" do before do @list = Hamster.interval(0, 10000) end it "doesn't run out of stack space" do @list.send(method) { |item| item } end end [ [[], []], [["A"], ["a"]], [["A", "B", "C"], ["a", "b", "c"]], ].each do |values, expected| describe "on #{values.inspect}" do before do @list = Hamster.list(*values) end describe "with a block" do it "returns #{expected}" do @list.send(method) { |item| item.downcase }.should == Hamster.list(*expected) end it "is lazy" do count = 0 @list.send(method) { |item| count += 1 } count.should <= 1 end end describe "without a block" do it "returns self" do @list.send(method).should equal(@list) end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.1.14 | spec/hamster/list/map_spec.rb |