Sha256: 6516964ca21e4550e2f112b14e3af5ce78573be39d7103ddf43658cdc23f75b4
Contents?: true
Size: 1.46 KB
Versions: 12
Compression:
Stored size: 1.46 KB
Contents
require File.expand_path('../../../spec_helper', __FILE__) require 'hamster/list' describe Hamster::List do [:maximum, :max].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) }.should_not raise_error end end describe "with a block" do [ [[], nil], [["A"], "A"], [["Ichi", "Ni", "San"], "Ichi"], ].each do |values, expected| describe "on #{values.inspect}" do before do original = Hamster.list(*values) @result = original.send(method) { |maximum, item| item.length <=> maximum.length } end it "returns #{expected.inspect}" do @result.should == expected end end end end describe "without a block" do [ [[], nil], [["A"], "A"], [["Ichi", "Ni", "San"], "San"], ].each do |values, expected| describe "on #{values.inspect}" do before do original = Hamster.list(*values) @result = original.send(method) end it "returns #{expected.inspect}" do @result.should == expected end end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems