Sha256: d7858bb81298ff11a2b070a7f567ab68eb2de33de1765cc22f5f46f655e53ff2
Contents?: true
Size: 1.74 KB
Versions: 2
Compression:
Stored size: 1.74 KB
Contents
require File.expand_path('../../spec_helper', File.dirname(__FILE__)) require 'hamster/list' describe Hamster::List do [:eql?, :==].each do |method| describe "##{method}" do describe "on a really big list" do before do @a = Hamster.interval(0, STACK_OVERFLOW_DEPTH) @b = Hamster.interval(0, STACK_OVERFLOW_DEPTH) end it "doesn't run out of stack" do lambda { @a.send(method, @b) }.should_not raise_error end end describe "returns false when comparing with" do before do @list = Hamster.list("A", "B", "C") end it "an array with the same contents" do @list.send(method, ["A", "B", "C"]).should == false end it "an aribtrary object" do @list.send(method, Object.new).should == false end end it "returns false when comparing an empty list with an empty array" do Hamster.list.send(method, []).should == false end [ [[], [], true], [[], [nil], false], [["A"], [], false], [["A"], ["A"], true], [["A"], ["B"], false], [["A", "B"], ["A"], false], [["A", "B", "C"], ["A", "B", "C"], true], [["C", "A", "B"], ["A", "B", "C"], false], ].each do |a, b, expected| describe "returns #{expected.inspect}" do before do @a = Hamster.list(*a) @b = Hamster.list(*b) end it "for lists #{a.inspect} and #{b.inspect}" do @a.send(method, @b).should == expected end it "for lists #{b.inspect} and #{a.inspect}" do @b.send(method, @a).should == expected end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.2.7 | spec/hamster/list/eql_spec.rb |
hamster-0.2.6 | spec/hamster/list/eql_spec.rb |