Proper error behavior when trying to rename a non-existent key

Change-Id: I00ee884e901e7505cd8c91d0e4002c850465b421
Reviewed-on: https://gerrit.causes.com/11454
Tested-by: Aiden Scandella <aiden@causes.com>
Reviewed-by: Elliot Block <elliot.block@causes.com>
Fix rename spec

This spec was failing because in 'real' redis, e.g. the part of the test
that hits an actual redis-server, the key 'foo' was set.

There's already a before block in spec_helper that clears out all keys
in the mock-redis-test:* namespace, so we changed the spec to use a key
under this namespace, which we know will not exist in either mock or
real redis.

Change-Id: I5ae9d1454034ee87f96724dd6c3597ef049cda9e
Reviewed-on: https://gerrit.causes.com/11458
Reviewed-by: Elliot Block <elliot.block@causes.com>
Tested-by: Elliot Block <elliot.block@causes.com>
Fix `mapped_hmset` spec

Both Redis and MockRedis raise a NoMethodError when you pass a value
that doesn't respond to `to_a` as the second argument for
`mapped_hmset`. So we changed the expectation to match.

Change-Id: I6237f39c373d61c9d08d3130db72a50235c1692f
Reviewed-on: https://gerrit.causes.com/11459
Reviewed-by: Elliot Block <elliot.block@causes.com>
Tested-by: Elliot Block <elliot.block@causes.com>
fix exception in transaction wrapper

Change-Id: Id9337b4c7eeea2fb386d4e01c982b779be9c1252
Reviewed-on: https://gerrit.causes.com/11461
Reviewed-by: Elliot Block <elliot.block@causes.com>
Tested-by: Elliot Block <elliot.block@causes.com>
redis-rb 3.0 support

Change-Id: I934f9c2c7dca52d0cdeb0de8308f3d7e74bae77b
Reviewed-on: https://gerrit.causes.com/11463
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Replace ruby-debug19 with debugger for Ruby 1.9.3 support

Change-Id: I32f7817af9844bc7db4b70f5c437d7b3133377ca
Reviewed-on: https://gerrit.causes.com/11464
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Raise Redis::CommandError instead of RuntimeError

Change-Id: I532632e8a080d22f63876157d822f8208ef3a6f7
Reviewed-on: https://gerrit.causes.com/11465
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Redis now returns arrays and floats

Change-Id: I2b4dc124c003c8c8660d979af43888c9a42287ee
Reviewed-on: https://gerrit.causes.com/11466
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Redis now returns booleans

Change-Id: I11c6b2e012108316c9a7fdb7ef2e39beee236162
Reviewed-on: https://gerrit.causes.com/11467
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Redis now allows subsecond timeouts

Change-Id: Icea11b0332def38524d62704e457d8bc28116cc9
Reviewed-on: https://gerrit.causes.com/11468
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Redis now returns nil for watch

Change-Id: I354aa1efc8437d0b0822d81ee1bee1bb329f1fdf
Reviewed-on: https://gerrit.causes.com/11469
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Test more hmset edge cases

Change-Id: I1ca5d48cf385484389bbfc6d20edf9325fd8ec51
Reviewed-on: https://gerrit.causes.com/11470
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Support variadic versions of commands: SADD, HDEL, SREM, ZREM, ZADD, L/RPUSH

Change-Id: Iac9d52ef9b4d35cbc2ab791bef72c5f194267466
Reviewed-on: https://gerrit.causes.com/11471
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Fix rename behaviour for nonexistant keys (Fixes #15)

Change-Id: Id329a77245e8b9e17bac1f278c6945d7f329a32c
Reviewed-on: https://gerrit.causes.com/11472
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Fix exception handling in transaction wrapper (Fixes #17)

Change-Id: I3dafc6184b76d4a3b7230d47c186e80ff1e0eb51
Reviewed-on: https://gerrit.causes.com/11473
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Add support for string arguments to zrange (Fixes #20)

Change-Id: I7830f9766d470fae1f2d98cde66bcfa12138a557
Reviewed-on: https://gerrit.causes.com/11474
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Support mocks for Redis::Distributed

This feature was originally authored by yankov (https://github.com/yankov),
but has been squashed and submitted to gerrit through Causes. Original pull
request message below:

https://github.com/causes/mock_redis/pull/19

Redis::Distributed is a standard class from redis-rb that allows to create a
connection to a cluster of redis instances. It uses consistent hashing
algorithm to route writes and reads for each key to an according redis
instance.

The connection is created like this: Redis::Distributed.new(redis_urls). The
problem is that when you try to stub Redis.new, so that this connection will
use MockRedis instead of the Redis, it fails because MockRedis doesn't have
'options' property (as standard redis object has).

This commits resolve this problem. So by creating stubs like that:

Redis.should_receive(:new).any_number_of_times { |options| MockRedis.new(options) }

After when you call Redis::Distributed.new(array_of_redis_urls) that will
return connection to a "cluster" of redis mocks.

Change-Id: I53727d42e29ad291452af872bc4b826eaa02255c
Reviewed-on: https://gerrit.causes.com/11462
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Return smembers last added first, like real redis (Fixes #16)

Change-Id: Id38255e247a11a2ec66545bc1e04577b05585b2a
Reviewed-on: https://gerrit.causes.com/11475
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Added zcount support for -inf and +inf

Change-Id: I7270f916b1d8019844fad004ac601afc9fae1319
Reviewed-on: https://gerrit.causes.com/11476
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>
Rename distributed.rb to pipeline_methods.rb

Redis pipelining doesn't have much to do with distributed redis
commands. Make the file it lives in more obvious and explicit

Change-Id: I6b858e5fc570605823767263633a601529f23e63
Reviewed-on: https://gerrit.causes.com/11483
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Aiden Scandella <aiden@causes.com>