Permalink
Browse files

Define 'call' method on client to enable use with redis-store

  • Loading branch information...
jcrivera committed Mar 20, 2013
1 parent 91e3bed commit cd9d81096ca5783503467b06dfd9f58e7d4a8f2b
Showing with 13 additions and 0 deletions.
  1. +6 −0 lib/redis_failover/client.rb
  2. +7 −0 spec/client_spec.rb
@@ -36,6 +36,12 @@ class Client
end
end
+ def call(command, &block)
+ method = command[0]
+ args = command[1..-1]
+ dispatch(method, *args, &block)
+ end
+
# Creates a new failover redis client.
#
# @param [Hash] options the options used to initialize the client instance
View
@@ -66,6 +66,13 @@ def setup_zk
end
end
+ describe '#call' do
+ it 'should dispatch :call messages to correct method' do
+ client.should_receive(:dispatch).with(:foo, *['key'])
+ client.call([:foo, 'key'])
+ end
+ end
+
context 'with :master_only false' do
it 'routes read operations to a slave' do
called = false

0 comments on commit cd9d810

Please sign in to comment.