Sha256: b35bc9b3c9277fbd21eeed6bb89305083cef3b19586e824e011c0cfb133ab084

Contents?: true

Size: 548 Bytes

Versions: 6

Compression:

Stored size: 548 Bytes

Contents

require 'spec_helper'
require 'redpomo/file_cache'
require 'tempfile'

describe Redpomo::FileCache do

  describe "#get" do
    it "executes the block on cache miss" do
      old_cache_path = Redpomo::FileCache.instance.cache_path
      Redpomo::FileCache.instance.cache_path = tmp_path("cache_file")

      counter = Redpomo::FileCache.get("foobar") { 5 }
      counter.should == 5

      counter = Redpomo::FileCache.get("foobar") { 10 }
      counter.should == 5

      Redpomo::FileCache.instance.cache_path = old_cache_path
    end
  end

end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
redpomo-reloaded-0.0.14 spec/file_cache_spec.rb
redpomo-reloaded-0.0.13 ./spec/file_cache_spec.rb
redpomo-0.0.13 spec/file_cache_spec.rb
redpomo-0.0.12 spec/file_cache_spec.rb
redpomo-0.0.11 spec/file_cache_spec.rb
redpomo-0.0.10 spec/file_cache_spec.rb