Sha256: d2ccd9f50c6cf7b5630d2c54a008b946b0d511392890c12d97cc64d6621ab6ae
Contents?: true
Size: 860 Bytes
Versions: 2
Compression:
Stored size: 860 Bytes
Contents
require 'rubygems' require 'spec' require File.dirname(__FILE__) + '/../lib/hash-cache' describe Hash::Cache do it 'should not have #get or #set methods by default' do Hash.new.should_not respond_to('get') Hash.new.should_not respond_to('set') end it 'should get a useful message if including Hash::Cache in an incompatible class' do lambda { Fixnum.send :include, Hash::Cache }.should raise_error(/can only be included in objects that implement the \[\]= method/) end it 'should have an easy way to get an instance of Hash with Hash::Cache included' do cache = Hash::Cache.new cache.get('chunky').should be_nil cache.set 'chunky', 'bacon' cache.get('chunky').should == 'bacon' end it 'should accept an existing Hash in the constructor' do Hash::Cache.new( :x => 5 ).get(:x).should == 5 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
devfu-hash-cache-0.1.0 | spec/hash-cache_spec.rb |
devfu-hash-cache-0.1.1 | spec/hash-cache_spec.rb |