Permalink
Browse files

Allow the error handler to be configured

  • Loading branch information...
brynary authored and fredjean committed Jan 21, 2010
1 parent 75834d9 commit d765121b205a5a3dd4954ca40b957b475ac0bf62
Showing with 10 additions and 0 deletions.
  1. +1 −0 lib/memcache.rb
  2. +9 −0 spec/jruby_memcache_spec.rb
View
@@ -87,6 +87,7 @@ def initialize(*args)
@client = MemCachedClient.new(@pool_name)
+ @client.error_handler = opts[:error_handler] if opts[:error_handler]
@client.primitiveAsString = true
@client.sanitizeKeys = false
@@ -36,6 +36,15 @@
@client = MemCache.new([@server], :pool_name => 'new_pool')
@client.pool_name.should == 'new_pool'
end
+
+ it "should work with an error handler" do
+ include_class 'com.danga.MemCached.MemCachedClient'
+ java_memcache_client = mock.as_null_object
+ MemCachedClient.stub!(:new => java_memcache_client)
+ error_handler = Object.new
+ java_memcache_client.should_receive(:error_handler=).with(error_handler)
+ @client = MemCache.new([@server], :error_handler => error_handler)
+ end
end
describe "namespacing" do

0 comments on commit d765121

Please sign in to comment.