Sha256: 60c47df196bc1930f8ae2013eb3f1aa75d7c5b8ffda94d63bdd37f85e4086959

Contents?: true

Size: 1.32 KB

Versions: 19

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe Internals::Index::Redis::Basic do
  
  let(:redis) { described_class.new "some_namespace" }

  describe 'load, retrieve, backup, delete' do
    it 'is nothing they do (at least on the backend)' do
      redis.should_receive(:backend).never
      
      redis.load
      redis.retrieve
      redis.backup
      redis.delete
    end
  end
  
  describe 'cache_small?' do
    context 'size 0' do
      before(:each) do
        redis.stub! :size => 0
      end
      it 'is small' do
        redis.cache_small?.should == true
      end
    end
    context 'size 1' do
      before(:each) do
        redis.stub! :size => 1
      end
      it 'is not small' do
        redis.cache_small?.should == false
      end
    end
  end
  
  describe 'cache_ok?' do
    context 'size 0' do
      before(:each) do
        redis.stub! :size => 0
      end
      it 'is not ok' do
        redis.cache_ok?.should == false
      end
    end
    context 'size 1' do
      before(:each) do
        redis.stub! :size => 1
      end
      it 'is ok' do
        redis.cache_ok?.should == true
      end
    end
  end
  
  describe "size" do
    it 'delegates to the backend' do
      backend = stub :backend
      redis.stub! :backend => backend
      
      backend.should_receive(:dbsize).once.with
      
      redis.size
    end
  end
  
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
picky-2.5.2 spec/lib/internals/index/redis/basic_spec.rb
picky-2.5.1 spec/lib/internals/index/redis/basic_spec.rb
picky-2.5.0 spec/lib/internals/index/redis/basic_spec.rb
picky-2.4.3 spec/lib/internals/index/redis/basic_spec.rb
picky-2.4.2 spec/lib/internals/index/redis/basic_spec.rb
picky-2.4.1 spec/lib/internals/index/redis/basic_spec.rb
picky-2.4.0 spec/lib/internals/index/redis/basic_spec.rb
picky-2.3.0 spec/lib/internals/index/redis/basic_spec.rb
picky-2.2.1 spec/lib/internals/index/redis/basic_spec.rb
picky-2.2.0 spec/lib/internals/index/redis/basic_spec.rb
picky-2.1.2 spec/lib/internals/index/redis/basic_spec.rb
picky-2.1.1 spec/lib/internals/index/redis/basic_spec.rb
picky-2.1.0 spec/lib/internals/index/redis/basic_spec.rb
picky-2.0.0 spec/lib/internals/index/redis/basic_spec.rb
picky-2.0.0.pre3 spec/lib/internals/index/redis/basic_spec.rb
picky-2.0.0.pre2 spec/lib/internals/index/redis/basic_spec.rb
picky-2.0.0.pre1 spec/lib/internals/index/redis/basic_spec.rb
picky-1.5.4 spec/lib/internals/index/redis/basic_spec.rb
picky-1.5.3 spec/lib/internals/index/redis/basic_spec.rb