Sha256: 22ff3a6c45517081187cf235ce366f0b5f14d426897ca2142a78251c5c33e094
Contents?: true
Size: 748 Bytes
Versions: 2
Compression:
Stored size: 748 Bytes
Contents
require File.expand_path('../../spec_helper', File.dirname(__FILE__)) require 'hamster/hash' describe Hamster::Hash do [:has_key?, :key?, :include?, :member?].each do |method| describe "#has_key?" do before do @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see", nil => "NIL", 2.0 => "two") end ["A", "B", "C", nil, 2.0].each do |key| it "returns true for an existing key (#{key.inspect})" do @hash.send(method, key).should == true end end it "returns false for a non-existing key" do @hash.send(method, "D").should == false end it "uses #eql? for equality" do @hash.send(method, 2).should == false end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.2.7 | spec/hamster/hash/has_key_spec.rb |
hamster-0.2.6 | spec/hamster/hash/has_key_spec.rb |