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

Version Path
automate-it-0.9.2 spec/unit/hashcache_spec.rb
automate-it-0.9.1 spec/unit/hashcache_spec.rb
automate-it-0.9.0 spec/unit/hashcache_spec.rb
automateit-0.70923 spec/unit/hashcache_spec.rb
automateit-0.70928 spec/unit/hashcache_spec.rb
automateit-0.71003 spec/unit/hashcache_spec.rb
automateit-0.70930 spec/unit/hashcache_spec.rb
automateit-0.71017 spec/unit/hashcache_spec.rb
automateit-0.71021 spec/unit/hashcache_spec.rb
automateit-0.71031.2 spec/unit/hashcache_spec.rb
automateit-0.71012 spec/unit/hashcache_spec.rb
automateit-0.71006 spec/unit/hashcache_spec.rb
automateit-0.71031.1 spec/unit/hashcache_spec.rb
automateit-0.71030 spec/unit/hashcache_spec.rb
automateit-0.71031 spec/unit/hashcache_spec.rb
automateit-0.71101 spec/unit/hashcache_spec.rb
automateit-0.71101.2 spec/unit/hashcache_spec.rb
automateit-0.71102 spec/unit/hashcache_spec.rb
automateit-0.71103 spec/unit/hashcache_spec.rb
automateit-0.71101.1 spec/unit/hashcache_spec.rb