Sha256: b89a5ee8b09d060b7399c800138ec8730b60ec3d238471ecf6af8f356688b9e1
Contents?: true
Size: 1 KB
Versions: 5
Compression:
Stored size: 1 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'hamster/hash' 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
5 entries across 5 versions & 1 rubygems