Sha256: b6d5ee0b8e258fdda63c01588388fa0517dd0eacd6e3045e1db85bfc166a0326
Contents?: true
Size: 703 Bytes
Versions: 31
Compression:
Stored size: 703 Bytes
Contents
require File.join(File.dirname(File.expand_path(__FILE__)), "/../spec_helper.rb") describe "HashCache" do before(:each) do @c = HashCache.new end it "should store and fetch values" do @c.store("foo", "bar") @c.fetch("foo").should == "bar" end it "should store values when needed if given a block" do @c.fetch("foo"){"bar"}.should == "bar" @c.fetch("foo").should == "bar" end it "should use HashCached values" do @c.fetch("foo"){"bar"}.should == "bar" @c.fetch("foo"){raise Exception.new("won't be raised")}.should == "bar" end it "should invalidate values" do @c.store("foo", "bar") @c.delete("foo") @c.fetch("foo").should be_nil end end
Version data entries
31 entries across 31 versions & 2 rubygems