Sha256: 5b22aa9cb0bd252af511d8992291562b35822b4df063429d5cb585e3a828e510

Contents?: true

Size: 1 KB

Versions: 9

Compression:

Stored size: 1 KB

Contents

require 'test_helper'

describe Redis::Store do
  before do
    @store  = Redis::Store.new
    @client = @store.instance_variable_get(:@client)
  end

  it "returns useful informations about the server" do
    @store.to_s.must_equal("Redis Client connected to #{@client.host}:#{@client.port} against DB #{@client.db}")
  end

  it "must force reconnection" do
    @client.expects(:reconnect)
    @store.reconnect
  end

  describe '#set' do
    describe 'with expiry' do
      let(:key) { 'key' }
      let(:value) { 'value' }
      let(:options) { { :expire_after => 3600 } }

      it 'must not double marshall' do
        Marshal.expects(:dump).once

        @store.set(key, value, options)
      end
    end
  end

  describe '#setnx' do
    describe 'with expiry' do
      let(:key) { 'key' }
      let(:value) { 'value' }
      let(:options) { { :expire_after => 3600 } }

      it 'must not double marshall' do
        Marshal.expects(:dump).once

        @store.setnx(key, value, options)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 4 rubygems

Version Path
redis-store-1.1.4 test/redis/store_test.rb
redis-store-json-3.0.0 redis-store-json/test/redis/store_test.rb
redis-rack-json-1.5.2 redis-store-json/test/redis/store_test.rb
redis-actionpack-json-4.0.0 redis-store-json/test/redis/store_test.rb
redis-store-1.1.3 test/redis/store_test.rb
redis-store-1.1.2 test/redis/store_test.rb
redis-store-1.1.1 test/redis/store_test.rb
redis-store-1.1.0 test/redis/store_test.rb
redis-store-1.1.0.rc2 test/redis/store_test.rb