Sha256: 85e636db34723a14ee308e1c39e3c55a66da9ac7faca0162c3a1442591550ad8
Contents?: true
Size: 998 Bytes
Versions: 3
Compression:
Stored size: 998 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? { |item| 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.1.13 | spec/hamster/hash/all_spec.rb |
hamster-0.1.12 | spec/hamster/hash/all_spec.rb |
hamster-0.1.11 | spec/hamster/hash/all_spec.rb |