Sha256: 0d395bf91df62e4dae4a64b51e8011ccddb260bff4b6d88c1b28b88f168e652f

Contents?: true

Size: 612 Bytes

Versions: 4

Compression:

Stored size: 612 Bytes

Contents

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

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 be_true
        end

      end

      it "returns false for a non-existing key" do
        @hash.send(method, "D").should be_false
      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hamster-0.1.14 spec/hamster/hash/has_key_spec.rb
hamster-0.1.13 spec/hamster/hash/has_key_spec.rb
hamster-0.1.12 spec/hamster/hash/has_key_spec.rb
hamster-0.1.11 spec/hamster/hash/has_key_spec.rb