Sha256: 51c41385e2ec5e4f45a84284f8a69e5c9e1844d51221250f323ba19bd43ba319
Contents?: true
Size: 1.17 KB
Versions: 15
Compression:
Stored size: 1.17 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'hamster/hash' describe Hamster::Hash do [:put, :[]=].each do |method| describe "##{method}" do before do @original = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") end describe "with a unique key" do before do @result = @original.send(method, "D", "dee") end it "preserves the original" do @original.should == Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") end it "returns a copy with the superset of key/value pairs" do @result.should == Hamster.hash("A" => "aye", "B" => "bee", "C" => "see", "D" => "dee") end end describe "with a duplicate key" do before do @result = @original.send(method, "C", "sea") end it "preserves the original" do @original.should == Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") end it "returns a copy with the superset of key/value pairs" do @result.should == Hamster.hash("A" => "aye", "B" => "bee", "C" => "sea") end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems