Sha256: 928a51cce4d9744025f3635b48eb5c6e2871e62925aa12ac007673e72ab4acb3

Contents?: true

Size: 943 Bytes

Versions: 15

Compression:

Stored size: 943 Bytes

Contents

require 'spec_helper'

describe Internals::Index::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 a single value from a Redis ListHash. Use Index::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! :lrange => :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(:lrange).once.with "some_namespace:some_sym", 0, -1
      
      index.collection :some_sym
    end
  end
  
end

Version data entries

15 entries across 15 versions & 1 rubygems

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