Sha256: ba27f535ec31a92a44128bb9cf81c5d3c9ea035ac74e4e576bfb00a35154c5d0
Contents?: true
Size: 782 Bytes
Versions: 7
Compression:
Stored size: 782 Bytes
Contents
require 'spec_helper' require 'hamster/hash' describe Hamster::Hash do [:each, :foreach].each do |method| describe "##{method}" do before do @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") end describe "with a block (internal iteration)" do it "returns nil" do @hash.send(method) {}.should be_nil end it "yields all key/value pairs" do actual_pairs = {} @hash.send(method) { |key, value| actual_pairs[key] = value } actual_pairs.should == {"A" => "aye", "B" => "bee", "C" => "see"} end end describe "with no block" do it "returns self" do @hash.send(method).should equal(@hash) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems