Sha256: b62112e18fa20c1981a43d4baa39e20fdc120ba73ba554fb6828aea9ad3cd6e5

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

require 'spec_helper'

describe '#mapped_hmget(key, *fields)' do
  before do
    @key = 'mock-redis-test:mapped_hmget'
    @redises.hmset(@key, 'k1', 'v1', 'k2', 'v2')
  end

  it 'returns values stored at key' do
    @redises.mapped_hmget(@key, 'k1', 'k2').should == { 'k1' => 'v1', 'k2' => 'v2' }
  end

  it 'returns nils for missing fields' do
    @redises.mapped_hmget(@key, 'k1', 'mock-redis-test:nonesuch').
      should == { 'k1' => 'v1', 'mock-redis-test:nonesuch' => nil }
  end

  it 'raises an error if given no fields' do
    lambda do
      @redises.mapped_hmget(@key)
    end.should raise_error(RuntimeError)
  end

  it_should_behave_like 'a hash-only command'
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mock_redis-0.15.0 spec/commands/mapped_hmget_spec.rb