Sha256: 3e9305616974fd74b37a957014685cec2202e605f9f3d5ad4601a672ad8d98ef
Contents?: true
Size: 1.16 KB
Versions: 11
Compression:
Stored size: 1.16 KB
Contents
require 'spec_helper' module VinExploder module Cache describe Store do describe '#read' do it 'should return the cached vin explosion' do Store.new.read('DOESNTMATTER').should == nil end it 'should return nil if no explosion found' do Store.new.read('DOESNTMATTER').should == nil end end describe '#write' do it 'should return the value that was written' do Store.new.write('VIN', 'EXPLODED_VIN').should == 'EXPLODED_VIN' Store.new.read('VIN').should == nil end end describe '#fetch' do it 'should execute the block and pass through #write' do result = {'vin' => 'EXPLODED_VIN'} store = Store.new store.should_not_receive(:write).exactly(1).times store.fetch('VIN') do result end.should == result end it 'should return nil with no block' do store = Store.new store.should_receive(:read).with('VIN').exactly(1).times { 'EXPLODED_VIN' } store.fetch('VIN').should == 'EXPLODED_VIN' end end describe '#delete' do it 'should return true if cache item was deleted' do Store.new.delete('VIN').should == true end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems