Sha256: cfe9052ab4ed3dd37da3995ce892852ff247b13fe8d4ba78591539ec6e49a898
Contents?: true
Size: 830 Bytes
Versions: 2
Compression:
Stored size: 830 Bytes
Contents
require File.expand_path('../../spec_helper', File.dirname(__FILE__)) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.2.7 | spec/hamster/hash/each_spec.rb |
hamster-0.2.6 | spec/hamster/hash/each_spec.rb |