Sha256: a5379ecaf061c1e9aeed2779d2459ceca8685b7904c5734a9f6b8d82af93d3c4

Contents?: true

Size: 522 Bytes

Versions: 13

Compression:

Stored size: 522 Bytes

Contents

require 'minitest_helper'

describe Datacenter::Cache do
  
  it 'Without expiration' do
    cache = Datacenter::Cache.new
    i = 0
    3.times do 
      cache.fetch(:key_1) { i += 1 }.must_equal 1
    end
  end

  it 'Cached key' do
    cache = Datacenter::Cache.new 1000
    i = 0
    3.times do 
      cache.fetch(:key_1) { i += 1 }.must_equal 1
    end
  end

  it 'Expired key' do
    cache = Datacenter::Cache.new 0
    i = 0
    1.upto(3) do |n|
      cache.fetch(:key_1) { i += 1 }.must_equal n
    end
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
datacenter-0.5.1 spec/cache_spec.rb
datacenter-0.5.0 spec/cache_spec.rb
datacenter-0.4.4 spec/cache_spec.rb
datacenter-0.4.3 spec/cache_spec.rb
datacenter-0.4.2 spec/cache_spec.rb
datacenter-0.4.0 spec/cache_spec.rb
datacenter-0.3.1 spec/cache_spec.rb
datacenter-0.2.2 spec/cache_spec.rb
datacenter-0.2.1 spec/cache_spec.rb
datacenter-0.2.0 spec/cache_spec.rb
datacenter-0.1.2 spec/cache_spec.rb
datacenter-0.1.1 spec/cache_spec.rb
datacenter-0.1.0 spec/cache_spec.rb