Sha256: 75ade3898624a9c2c445cafc880287ee3d1915faeb820c82537a17f4aebc1ca2

Contents?: true

Size: 636 Bytes

Versions: 10

Compression:

Stored size: 636 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

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")
      end

      ["A", "B", "C", nil].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

    end

  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hamster-0.2.5 spec/hamster/hash/has_key_spec.rb
hamster-0.2.4 spec/hamster/hash/has_key_spec.rb
hamster-0.2.3 spec/hamster/hash/has_key_spec.rb
hamster-0.2.2 spec/hamster/hash/has_key_spec.rb
hamster-0.2.1 spec/hamster/hash/has_key_spec.rb
hamster-0.2.0 spec/hamster/hash/has_key_spec.rb
hamster-0.1.23 spec/hamster/hash/has_key_spec.rb
hamster-0.1.22 spec/hamster/hash/has_key_spec.rb
hamster-0.1.21 spec/hamster/hash/has_key_spec.rb
hamster-0.1.20 spec/hamster/hash/has_key_spec.rb