Sha256: 4acd100b16982e983b7539c17dcf5a4650c8579a7eb8255745d458272c1f184c

Contents?: true

Size: 1.11 KB

Versions: 7

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe Picky::Backend::Redis::ListHash do
  
  let(:index) { described_class.new :some_namespace }
  
  describe 'member' do
    it 'raises an error' do
      expect {
        index.member :some_sym
      }.to raise_error("Can't retrieve single value :some_sym from a Redis ListHash. Use Indexes::Redis::StringHash.")
    end
  end
  
  describe 'collection' do
    it 'returns whatever comes back from the backend' do
      backend = stub :backend
      index.should_receive(:backend).and_return backend
      
      backend.stub! :zrange => :some_lrange_result
      
      index.collection(:anything).should == :some_lrange_result
    end
    it 'calls the right method on the backend' do
      backend = stub :backend
      index.should_receive(:backend).and_return backend
      
      backend.should_receive(:zrange).once.with "some_namespace:some_sym", 0, -1
      
      index.collection :some_sym
    end
  end
  
  describe 'to_s' do
    it 'returns the cache path with the default file extension' do
      index.to_s.should == 'Picky::Backend::Redis::ListHash(some_namespace:*)'
    end
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
picky-3.0.1 spec/lib/backend/redis/list_hash_spec.rb
picky-3.0.0 spec/lib/backend/redis/list_hash_spec.rb
picky-3.0.0.pre5 spec/lib/backend/redis/list_hash_spec.rb
picky-3.0.0.pre4 spec/lib/backend/redis/list_hash_spec.rb
picky-3.0.0.pre3 spec/lib/backend/redis/list_hash_spec.rb
picky-3.0.0.pre2 spec/lib/backend/redis/list_hash_spec.rb
picky-3.0.0.pre1 spec/lib/backend/redis/list_hash_spec.rb