Sha256: 762d4a95f7f7da4afa2356dea5cf39179a88d0b2fcdec0c17e8497772ed59ab7
Contents?: true
Size: 773 Bytes
Versions: 6
Compression:
Stored size: 773 Bytes
Contents
require File.dirname(__FILE__) + '/../spec_helper' require 'mspec/helpers/hash' describe Object, "#hash_class" do it "returns the Hash class" do hash_class.should == Hash end end describe Object, "#new_hash" do it "returns a default hash" do new_hash.should == {} end it "returns a hash having a default value" do hash = new_hash(5) hash[:none].should == 5 end it "returns a hash having a default proc" do hash = new_hash { |h, k| h[k] = :default } hash[:none].should == :default end it "returns a hash constructed from keys and values" do new_hash({:a => 1, :b => 2}).should == { :a => 1, :b => 2 } new_hash(1 => 2, 3 => 4).should == { 1 => 2, 3 => 4 } new_hash(1, 2, 3, 4).should == { 1 => 2, 3 => 4 } end end
Version data entries
6 entries across 6 versions & 1 rubygems