spec/commands/mget_spec.rb in mock_redis-0.19.0 vs spec/commands/mget_spec.rb in mock_redis-0.20.0

- old
+ new

@@ -7,28 +7,47 @@ @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 + context 'emulate param array' do + 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 an array of values' do + @redises.mget([@key1, @key2]).should == %w[1 2] + end - it 'returns nil for non-string keys' do - list = 'mock-redis-test:mget-list' + it 'returns nil for non-string keys' do + list = 'mock-redis-test:mget-list' - @redises.lpush(list, 'bork bork bork') + @redises.lpush(list, 'bork bork bork') - @redises.mget(@key1, @key2, list).should == ['1', '2', nil] + @redises.mget([@key1, @key2, list]).should == ['1', '2', nil] + end end - it 'raises an error if you pass it 0 arguments' do - lambda do - @redises.mget - end.should raise_error(Redis::CommandError) + context 'emulate params strings' do + 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(Redis::CommandError) + end end end