Sha256: 1171c3a09d8f4758c2d86117420381a6222989df9f275232e8d995c774a5aca6

Contents?: true

Size: 814 Bytes

Versions: 13

Compression:

Stored size: 814 Bytes

Contents

require 'spec_helper'

describe '#pipelined' do
  it 'yields to its block' do
    res = false
    @redises.pipelined do
      res = true
    end
    res.should == true
  end

  context 'with a few added data' do
    let(:key1)   { 'hello' }
    let(:key2)   { 'world' }
    let(:value1) { 'foo' }
    let(:value2) { 'bar' }

    before do
      @redises.set key1, value1
      @redises.set key2, value2
    end

    it 'returns results of pipelined operations' do
      results = @redises.pipelined do |redis|
        redis.get key1
        redis.get key2
      end

      results.should == [value1, value2]
    end

    it 'returns futures' do
      future = nil

      @redises.mock.pipelined do |redis|
        future = redis.get key1
      end

      future.class.should be MockRedis::Future
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mock_redis-0.19.0 spec/commands/pipelined_spec.rb
mock_redis-0.18.0 spec/commands/pipelined_spec.rb
mock_redis-0.17.3 spec/commands/pipelined_spec.rb
mock_redis-0.17.2 spec/commands/pipelined_spec.rb
mock_redis-0.17.1 spec/commands/pipelined_spec.rb
mock_redis-0.17.0 spec/commands/pipelined_spec.rb
mock_redis-0.16.1 spec/commands/pipelined_spec.rb
mock_redis-0.16.0 spec/commands/pipelined_spec.rb
mock_redis-0.15.4 spec/commands/pipelined_spec.rb
mock_redis-0.15.3 spec/commands/pipelined_spec.rb
mock_redis-0.15.2 spec/commands/pipelined_spec.rb
mock_redis-0.15.1 spec/commands/pipelined_spec.rb
mock_redis-0.15.0 spec/commands/pipelined_spec.rb