Sha256: cb82dc4ab8ae6aa4368c8188e465eb2c1611b9dbdaf3975b7419bc7c929da8a7
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
require "spec_helper" require "hamster/list" describe Hamster::List do describe "#none?" 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.none? { false } }.should_not raise_error end end describe "when empty" do before do @list = Hamster.list end it "with a block returns true" do @list.none? {}.should == true end it "with no block returns true" do @list.none?.should == true end end describe "when not empty" do describe "with a block" do before do @list = Hamster.list("A", "B", "C", nil) end ["A", "B", "C", nil].each do |value| it "returns false if the block ever returns true (#{value.inspect})" do @list.none? { |item| item == value }.should == false end end it "returns true if the block always returns false" do @list.none? { |item| item == "D" }.should == true end end describe "with no block" do it "returns false if any value is truthy" do Hamster.list(nil, false, true, "A").none?.should == false end it "returns true if all values are falsey" do Hamster.list(nil, false).none?.should == true 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/none_spec.rb |