Sha256: 8b3caccfb4a2920e13b938f88e0b26163a2b9bd277ec49f02ec78ffe3678179b

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

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

describe WebMock::Util::HashCounter do

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

  it "should increase the returned value on every put with the same key" do
    counter = WebMock::Util::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 = WebMock::Util::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-1.5.0 spec/util/hash_counter_spec.rb
webmock-1.4.0 spec/util/hash_counter_spec.rb