spec/storage_engine/abstract_spec.rb in lawnchair-0.6.9 vs spec/storage_engine/abstract_spec.rb in lawnchair-0.6.10

- old
+ new

@@ -22,10 +22,16 @@ it "returns the value from the cache" do value = abstract_store.fetch("sim", :raw => true) { "DOESNT MATTER" } value.should == "ba" end + + it "increments the cache HIT count for this key" do + abstract_store.fetch("sim", :raw => true) { "DOESNT MATTER" } + abstract_store.fetch("sim", :raw => true) { "DOESNT MATTER" } + Lawnchair.redis.hget("HIT", "Lawnchair:sim").should == "2" + end end context "when key does not exist" do before do abstract_store.stub!(:exists?).and_return(false) @@ -39,9 +45,18 @@ end it "computes the value and saves it to the cache" do value = abstract_store.fetch("sim", :raw => true) { "ba" } abstract_store.data_store["Lawnchair:sim"].should == "ba" + end + + it "increments the cache MISS count for this key" do + abstract_store.fetch("sim", :raw => true) { "ba" } + abstract_store.data_store["Lawnchair:sim"] = nil + abstract_store.fetch("sim", :raw => true) { "ba" } + abstract_store.data_store["Lawnchair:sim"] = nil + abstract_store.fetch("sim", :raw => true) { "ba" } + Lawnchair.redis.hget("MISS", "Lawnchair:sim").should == "3" end end end describe ".get" do \ No newline at end of file