Sha256: 23d0e0a2af780d338e25ed38020f3f3cdcb5f991a46abe7e4bf74831403c9558

Contents?: true

Size: 557 Bytes

Versions: 12

Compression:

Stored size: 557 Bytes

Contents

require 'spec_helper'

describe ZendeskAPI::LRUCache do
  let(:cache){ ZendeskAPI::LRUCache.new(2) }

  it "writes and reads" do
    cache.write("x", 1).should == 1
    cache.read("x").should == 1
  end

  it "drops" do
    cache.write("x", 1)
    cache.write("y", 1)
    cache.write("x", 1)
    cache.write("z", 1)
    cache.read("z").should == 1
    cache.read("x").should == 1
    cache.read("y").should == nil
  end

  it "fetches" do
    cache.fetch("x"){ 1 }.should == 1
    cache.read("x").should == 1
    cache.fetch("x"){ 2 }.should == 1
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
zendesk_api-0.1.11 spec/lru_cache_spec.rb
zendesk_api-0.1.10 spec/lru_cache_spec.rb
zendesk_api-0.1.9 spec/lru_cache_spec.rb
zendesk_api-0.1.8 spec/lru_cache_spec.rb
zendesk_api-0.1.7 spec/lru_cache_spec.rb
zendesk_api-0.1.6 spec/lru_cache_spec.rb
zendesk_api-0.1.5 spec/lru_cache_spec.rb
zendesk_api-0.1.4 spec/lru_cache_spec.rb
zendesk_api-0.1.3 spec/lru_cache_spec.rb
zendesk_api-0.1.2 spec/lru_cache_spec.rb
zendesk_api-0.1.1 spec/lru_cache_spec.rb
zendesk_api-0.0.9 spec/lru_cache_spec.rb