Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require File.join(File.dirname(__FILE__) , "helpers")
- def fill_cache(cache)
- cache[:key1] = "value1"
- cache[:key2] = "value2"
- end
- describe "Waves::Cache" do
- before do
- cache = Waves::Cache.new
- fill_cache cache
- end
- it "can find a value in the cache" do
- cache[:key1].should == "value1"
- end
- it "can delete a value from the cache" do
- fill_cache cache
- cache.delete(:key1)
- cache[:key1].should == nil
- cache[:key2].should == "value2"
- end
- it "can clear the cache" do
- fill_cache cache
- cache.clear
- cache[:key1].should == nil
- cache[:key2].should == nil
- end
- end
- require 'layers/cache/file_cache'
- describe "Waves::Layers::FileCache" do
- before do
- cache = Waves::Layers::FileCache.new('.')
- fill_cache cache
- end
- it "can find a value in the cache" do
- cache[:key1].should == "value1"
- end
- it "can delete a value from the cache" do
- fille_cache cache
- cache.delete(:key1)
- cache[:key1].should == nil
- cache[:key2].should == "value2"
- end
- it "can clear the cache" do
- fill_cache cache
- cache.clear
- cache[:key1].should == nil
- cache[:key2].should == nil
- end
- end
Add Comment
Please, Sign In to add comment