Sha256: a873eaaaa578f79c9ab8d00a58b1207394d009ca4f2332abe964d7383b7c4a91

Contents?: true

Size: 778 Bytes

Versions: 39

Compression:

Stored size: 778 Bytes

Contents

require 'spec_helper'

describe "#mget(key [, key, ...])" do
  before do
    @key1 = "mock-redis-test:mget1"
    @key2 = "mock-redis-test:mget2"

    @redises.set(@key1, 1)
    @redises.set(@key2, 2)
  end

  it "returns an array of values" do
    @redises.mget(@key1, @key2).should == %w[1 2]
  end

  it "returns nil for missing keys" do
    @redises.mget(@key1, 'mock-redis-test:not-found', @key2).
      should == ["1", nil, "2"]
  end

  it "returns nil for non-string keys" do
    list = "mock-redis-test:mget-list"

    @redises.lpush(list, 'bork bork bork')

    @redises.mget(@key1, @key2, list).should == ["1", "2", nil]
  end

  it "raises an error if you pass it 0 arguments" do
    lambda do
      @redises.mget()
    end.should raise_error(RuntimeError)
  end
end

Version data entries

39 entries across 39 versions & 2 rubygems

Version Path
mock_redis-0.14.1 spec/commands/mget_spec.rb
mock_redis-0.14.0 spec/commands/mget_spec.rb
mock_redis-0.13.2 spec/commands/mget_spec.rb
mock_redis-0.13.1 spec/commands/mget_spec.rb
mock_redis-0.13.0 spec/commands/mget_spec.rb
mock_redis-0.12.1 spec/commands/mget_spec.rb
mock_redis-0.12.0 spec/commands/mget_spec.rb
mock_redis-0.11.0 spec/commands/mget_spec.rb
mock_redis-0.10.0 spec/commands/mget_spec.rb
mock_redis-0.9.0 spec/commands/mget_spec.rb
mock_redis-0.8.2 spec/commands/mget_spec.rb
mock_redis-0.8.1 spec/commands/mget_spec.rb
mock_redis-0.8.0 spec/commands/mget_spec.rb
mock_redis-0.7.0 spec/commands/mget_spec.rb
mock_redis-0.6.6 spec/commands/mget_spec.rb
mock_redis-0.6.5 spec/commands/mget_spec.rb
mock_redis-0.6.4 spec/commands/mget_spec.rb
mock_redis-0.6.3 spec/commands/mget_spec.rb
mock_redis-0.6.2 spec/commands/mget_spec.rb
mock_redis-0.6.1 spec/commands/mget_spec.rb