Sha256: 164bff0e7f531fa219ec3a0a907198be6e542033e08a76189722ebaaffb78abc
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
require File.expand_path('../../spec_helper', File.dirname(__FILE__)) require 'hamster/hash' describe Hamster::Hash do [:all?, :forall?].each do |method| describe "##{method}" do describe "when empty" do before do @hash = Hamster.hash end it "with a block returns true" do @hash.send(method) {}.should == true end it "with no block returns true" do @hash.send(method).should == 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.send(method) { |key, value| true }.should == true end it "returns false if the block ever returns false" do @hash.send(method) { |key, value| key == "D" || value == "dee" }.should == false end end describe "with no block" do it "returns true" do @hash.send(method).should == true end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.2.7 | spec/hamster/hash/all_spec.rb |
hamster-0.2.6 | spec/hamster/hash/all_spec.rb |