Sha256: 3c7f74dacea7f7acd541f1afca38f3023b3d54c7e58946289eb8bfbb84be23b9
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
require_relative '../../spec_helper' describe Arachni::Cache::RandomReplacement do before { @cache = Arachni::Cache::RandomReplacement.new } it 'prunes itself by removing random entries (Random Replacement)' do @cache.max_size = 3 k = [ :k, :k2, :k3, :k4 ] @cache[k[0]] = '1' @cache[k[1]] = '2' @cache[k[2]] = '3' @cache[k[3]] = '4' @cache.size.should == 3 k.map { |key| @cache[key] }.count( nil ).should == 1 @cache.clear @cache.max_size = 1 @cache[k[0]] = '1' @cache[k[1]] = '3' @cache[k[2]] = '4' @cache.size.should == 1 k[0...3].map { |key| @cache[key] }.count( nil ).should == 2 end describe '#[]=' do it 'stores an object' do v = 'val' (@cache[:key] = v).should == v @cache[:key].should == v end it 'alias of #store' do v = 'val2' @cache.store( :key2, v ).should == v @cache[:key2].should == v end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
arachni-0.4.2 | spec/arachni/cache/random_replacement_spec.rb |