Sha256: b53f34e56240cfc5431e363d3df35b5c2462f2db1949ca65126f8eb069c06784
Contents?: true
Size: 1004 Bytes
Versions: 1
Compression:
Stored size: 1004 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Hamster::Hash do describe "#all?" do describe "when empty" do before do @hash = Hamster.hash end it "with a block returns true" do @hash.all? {}.should be_true end it "with no block returns true" do @hash.all?.should be_true end end describe "when not empty" do before do @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") end describe "with a block" do it "returns true if the block always returns true" do @hash.all? { |key, value| true }.should be_true end it "returns false if the block ever returns false" do @hash.all? { |key, value| key == "D" || value == "dee" }.should be_false end end describe "with no block" do it "returns true" do @hash.all?.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/hash/all_spec.rb |