Sha256: a0822b12b8a4fa9c56a50be2b4d0aab7bfa49d6bae991b8944e746ba6dca5d67

Contents?: true

Size: 828 Bytes

Versions: 7

Compression:

Stored size: 828 Bytes

Contents

require 'spec_helper'

describe Internals::Index::Redis::StringHash do
  
  let(:index) { described_class.new :some_namespace }
    
  describe 'collection' do
    it 'raises' do
      expect { index.collection :anything }.to raise_error("Can't retrieve a collection from a StringHash. Use Index::Redis::ListHash.")
    end
  end
  describe 'member' do
    before(:each) do
      @backend = stub :backend
      index.stub! :backend => @backend
    end
    it 'delegates to the backend' do
      @backend.should_receive(:hget).once.with :some_namespace, :some_symbol
      
      index.member :some_symbol
    end
    it 'returns whatever it gets from the backend' do
      @backend.should_receive(:hget).any_number_of_times.and_return :some_result
      
      index.member(:anything).should == :some_result
    end
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
picky-2.0.0.pre2 spec/lib/internals/index/redis/string_hash_spec.rb
picky-2.0.0.pre1 spec/lib/internals/index/redis/string_hash_spec.rb
picky-1.5.4 spec/lib/internals/index/redis/string_hash_spec.rb
picky-1.5.3 spec/lib/internals/index/redis/string_hash_spec.rb
picky-1.5.2 spec/lib/internals/index/redis/string_hash_spec.rb
picky-1.5.1 spec/lib/internals/index/redis/string_hash_spec.rb
picky-1.5.0 spec/lib/internals/index/redis/string_hash_spec.rb