Sha256: 355deeac7f48751aef440735113e4fcfac2e9dfc2c9a3109ac7e50c0e552bde7
Contents?: true
Size: 674 Bytes
Versions: 2
Compression:
Stored size: 674 Bytes
Contents
require File.join(File.dirname(__FILE__), "/../spec_helper") describe HashCache do it "should default to 10 records maximum" do h = HashCache.new (1..15).each { |i| h[i] = i } h.keys.size.should eql(10) h.keys.sort.first.should eql(6) h.keys.sort.last.should eql(15) end it "should take an optional :n parameter to limit the size of the cache" do h = HashCache.new(:n => 2) (1..15).each { |i| h[i] = i } h.keys.size.should eql(2) h.keys.sort.first.should eql(14) h.keys.sort.last.should eql(15) end it "should respond to n, revealing the cache size." do h = HashCache.new(:n => 2) h.n.should eql(2) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
davidrichards-repositories-0.0.4 | spec/repositories/hash_cache_spec.rb |
davidrichards-repositories-0.0.5 | spec/repositories/hash_cache_spec.rb |