Sha256: c9f1ddb9c26c472eaf0380a9503729ee829640852be9b61d04e1387497cff5e3
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
require "spec_helper" 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 -> { @list.send(method) }.should_not raise_error end end describe "with a block" do [ [[], nil], [["A"], "A"], [%w[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"], [%w[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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hamster-1.0.1.pre.rc.1 | spec/hamster/list/maximum_spec.rb |