Sha256: 4e56dd7fd17211d6dd90f491eab537cd8cd5d6f8a09334e081572fb58cd3187c

Contents?: true

Size: 612 Bytes

Versions: 2

Compression:

Stored size: 612 Bytes

Contents

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

describe HashCounter do

  it "should return 0 for non existing key" do
    HashCounter.new.get(:abc).should == 0
  end

  it "should increase the returned value on every put with the same key" do
    counter =HashCounter.new
    counter.put(:abc)
    counter.get(:abc).should == 1
    counter.put(:abc)
    counter.get(:abc).should == 2
  end

  it "should only increase value for given key provided to put" do
    counter =HashCounter.new
    counter.put(:abc)
    counter.get(:abc).should == 1
    counter.get(:def).should == 0
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webmock-0.7.1 spec/util/hash_counter_spec.rb
webmock-0.7.0 spec/util/hash_counter_spec.rb