Sha256: 3fbd27e1223b8f1ccb516605b15b77e0fcb1f1b2ee08fd64d37d879c46fed63b

Contents?: true

Size: 562 Bytes

Versions: 56

Compression:

Stored size: 562 Bytes

Contents

require 'core/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

56 entries across 56 versions & 1 rubygems

Version Path
zendesk_api-0.3.9 spec/core/lru_cache_spec.rb
zendesk_api-0.3.8 spec/core/lru_cache_spec.rb
zendesk_api-0.4.0.rc1 spec/core/lru_cache_spec.rb
zendesk_api-0.3.7 spec/core/lru_cache_spec.rb
zendesk_api-0.3.6 spec/core/lru_cache_spec.rb
zendesk_api-0.3.5 spec/core/lru_cache_spec.rb
zendesk_api-0.3.4 spec/core/lru_cache_spec.rb
zendesk_api-0.3.3 spec/core/lru_cache_spec.rb
zendesk_api-0.3.2 spec/core/lru_cache_spec.rb
zendesk_api-0.3.1 spec/core/lru_cache_spec.rb
zendesk_api-0.3.0 spec/core/lru_cache_spec.rb
zendesk_api-0.2.6 spec/core/lru_cache_spec.rb
zendesk_api-0.2.5 spec/core/lru_cache_spec.rb
zendesk_api-0.2.4 spec/core/lru_cache_spec.rb
zendesk_api-0.2.2 spec/core/lru_cache_spec.rb
zendesk_api-0.2.1 spec/core/lru_cache_spec.rb