Sha256: 101a5c6e74d67df3374b66155fed2b106fe5a49a4964a6db2696d3eb0d68897c
Contents?: true
Size: 975 Bytes
Versions: 10
Compression:
Stored size: 975 Bytes
Contents
require File.expand_path('spec/spec_helper') describe Ruco::FileStore do before do @folder = 'spec/sessions' `rm -rf #{@folder}` end after do `rm -rf #{@folder}` end let(:store){ Ruco::FileStore.new(@folder, :keep => 3) } it "can store stuff" do store.set('xxx', 1) store.get('xxx').should == 1 end it "can store :keep keys" do store.set('xxx', 1) store.set('yyy', 1) store.set('zzz', 1) store.set('aaa', 1) store.get('xxx').should == nil end it "drops least recently used key" do store.set('xxx', 1) store.set('yyy', 1) store.set('xxx', 1) store.set('zzz', 1) store.set('aaa', 1) store.get('xxx').should == 1 store.get('yyy').should == nil end it "does not drop if used multiple times" do store.set('xxx', 1) store.set('yyy', 1) store.set('zzz', 1) store.set('zzz', 1) store.set('zzz', 1) store.set('zzz', 1) store.get('xxx').should == 1 end end
Version data entries
10 entries across 10 versions & 1 rubygems