redis/redis-rb — pull request #257 by matthewbennink (2012-07-24 13:00:47+00:00)
Title: CommandError properly raised if EXEC fails.

When the max memory limit is reached within a MULTI block, I expected a CommandError to be raised. However, a NoMethodError was raised instead due to what appears to be a bug in the Pipeline::Multi class. I have included a test and patch.

Note that the transaction is left open after leaving the block. In the included test, if _discard_ is not called, then the result of resetting the maxmemory value is "QUEUED". This is the current behavior and seems to make sense since it allows the developer to rescue from a CommandError and choose what to do.

Test output before patch:

```
1) Failure:
test_raise_command_error_when_max_memory_reached(TestTransactions) [/Users/matt/code/github/redis-rb/test/transactions_test.rb:154]:
[Redis::CommandError] exception expected, not
Class:
Message: <"undefined method `size' for #">
---Backtrace---
/Users/matt/code/github/redis-rb/lib/redis/pipeline.rb:73:in `finish'
/Users/matt/code/github/redis-rb/lib/redis/client.rb:115:in `block in call_pipeline'
/Users/matt/code/github/redis-rb/lib/redis/client.rb:229:in `with_reconnect'
/Users/matt/code/github/redis-rb/lib/redis/client.rb:113:in `call_pipeline'
/Users/matt/code/github/redis-rb/lib/redis.rb:2027:in `block in multi'
/Users/matt/code/github/redis-rb/lib/redis.rb:36:in `block in synchronize'
---------------

443 tests, 1550 assertions, 1 failures, 0 errors, 0 skips
```