Sha256: 8ed9efa14db23ac3ee745dc800b73836a162c2a1e9a4508356279496cb8fa36b
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Hamster::List do describe "#none?" 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.none? { false } end end describe "when empty" do before do @list = Hamster.list end it "with a block returns true" do @list.none? {}.should be_true end it "with no block returns true" do @list.none?.should be_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 be_false end end it "returns true if the block always returns false" do @list.none? { |item| item == "D" }.should be_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 be_false end it "returns true if all values are falsey" do Hamster.list(nil, false).none?.should be_true end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.1.14 | spec/hamster/list/none_spec.rb |