Sha256: d919b603f8012f93b3a9a1ba9cc185c72bd56171c4b8639d74c4c58664fd6044
Contents?: true
Size: 910 Bytes
Versions: 2
Compression:
Stored size: 910 Bytes
Contents
require File.dirname(__FILE__) + '/spec_helper' describe APICache::Cache do before :each do @options = { :cache => 1, # After this time fetch new data :valid => 2 # Maximum time to use old data } end it "should set and get" do cache = APICache::Cache.new('flubble', @options) cache.set('Hello world') cache.get.should == 'Hello world' end it "should md5 encode the provided key" do cache = APICache::Cache.new('test_md5', @options) APICache.store.should_receive(:set). with('9050bddcf415f2d0518804e551c1be98', 'md5ing?') cache.set('md5ing?') end it "should report correct invalid states" do cache = APICache::Cache.new('foo', @options) cache.state.should == :missing cache.set('foo') cache.state.should == :current sleep 1 cache.state.should == :refetch sleep 1 cache.state.should == :invalid end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
mloughran-api_cache-0.2.0 | spec/cache_spec.rb |
api_cache-0.2.0 | spec/cache_spec.rb |