Sha256: 187e594e09dc9517345f04f41c8c6bd15a82a57717b7544bffd73eb25b6615f8

Contents?: true

Size: 1.12 KB

Versions: 100

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe Picky::Backends::Redis::String do
  
  let(:client) { stub :client }
  let(:backend) { described_class.new client, :some_namespace }
    
  describe 'dump' do
    it 'dumps correctly' do
      client.should_receive(:del).once.ordered.with  :some_namespace
      client.should_receive(:hset).once.ordered.with :some_namespace, :a, 1
      client.should_receive(:hset).once.ordered.with :some_namespace, :b, 2
      client.should_receive(:hset).once.ordered.with :some_namespace, :c, 3
      
      backend.dump a: 1, b: 2, c: 3
    end
  end
  
  describe 'member' do
    it 'delegates to the backend' do
      client.should_receive(:hget).once.with :some_namespace, :some_symbol
      
      backend[:some_symbol]
    end
    it 'returns whatever it gets from the backend' do
      client.should_receive(:hget).any_number_of_times.and_return :some_result
      
      backend[:anything].should == :some_result
    end
  end
  
  describe 'to_s' do
    it 'returns the cache path with the default file extension' do
      backend.to_s.should == 'Picky::Backends::Redis::String(some_namespace:*)'
    end
  end
  
end

Version data entries

100 entries across 100 versions & 1 rubygems

Version Path
picky-4.12.1 spec/lib/backends/redis/string_spec.rb
picky-4.12.0 spec/lib/backends/redis/string_spec.rb
picky-4.11.3 spec/lib/backends/redis/string_spec.rb
picky-4.11.2 spec/lib/backends/redis/string_spec.rb
picky-4.11.1 spec/lib/backends/redis/string_spec.rb
picky-4.11.0 spec/lib/backends/redis/string_spec.rb
picky-4.10.0 spec/lib/backends/redis/string_spec.rb
picky-4.9.0 spec/lib/backends/redis/string_spec.rb
picky-4.8.1 spec/lib/backends/redis/string_spec.rb
picky-4.8.0 spec/lib/backends/redis/string_spec.rb
picky-4.7.0 spec/lib/backends/redis/string_spec.rb
picky-4.6.6 spec/lib/backends/redis/string_spec.rb
picky-4.6.5 spec/lib/backends/redis/string_spec.rb
picky-4.6.4 spec/lib/backends/redis/string_spec.rb
picky-4.6.3 spec/lib/backends/redis/string_spec.rb
picky-4.6.2 spec/lib/backends/redis/string_spec.rb
picky-4.6.1 spec/lib/backends/redis/string_spec.rb
picky-4.6.0 spec/lib/backends/redis/string_spec.rb
picky-4.5.12 spec/lib/backends/redis/string_spec.rb
picky-4.5.11 spec/lib/backends/redis/string_spec.rb