Sha256: bda32a3db0d287ab7c5769c7cc2a1d4e4d94cc259d6eb6d64c90036c99fc0666

Contents?: true

Size: 911 Bytes

Versions: 3

Compression:

Stored size: 911 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Daijobu::Adapter::TokyoCabinetAdapter do
  
  before do
    @stubby   = stub('fake store')
    @adapter  = Daijobu::Adapter::TokyoCabinetAdapter.new(@stubby)
  end
  
  describe "#get" do
    it "should call #[] on the store" do
      @stubby.expects(:[]).with('key')
      @adapter.get('key')
    end
    
    describe "with no arguments" do
      it "should return nil" do
        @adapter.get.should be_nil
      end
    end
    
    describe "with multiple arguments" do
      it "should call #lget on all the keys" do
        @stubby.expects(:lget).with(['key1', 'key2', 'key3'])
        @adapter.get('key1', 'key2', 'key3')
      end      
    end
  end
  
  describe "set" do
    it "should call #set on the store" do
      @stubby.expects(:[]=).with('key', 'value')
      @adapter.set('key', 'value')
    end
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sander6-daijobu-0.2.0 spec/daijobu/adapters/tokyo_cabinet_spec.rb
sander6-daijobu-0.2.1 spec/daijobu/adapters/tokyo_cabinet_spec.rb
sander6-daijobu-0.3.0 spec/daijobu/adapters/tokyo_cabinet_spec.rb