Permalink
Browse files

updated Session::Memcache initialization to pass MemCache options cor…

…rectly

Signed-off-by: Christian Neukirchen <chneukirchen@gmail.com>
  • Loading branch information...
1 parent a38b0ae commit d1ffcae29d754e95776e0fde193747bd1627273f Simon Chiang committed with chneukirchen May 5, 2010
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/rack/session/memcache.rb
  2. +5 −0 test/spec_rack_session_memcache.rb
@@ -31,7 +31,7 @@ def initialize(app, options={})
@mutex = Mutex.new
mserv = @default_options[:memcache_server]
mopts = @default_options.
- reject{|k,v| MemCache::DEFAULT_OPTIONS.include? k }
+ reject{|k,v| !MemCache::DEFAULT_OPTIONS.include? k }
@pool = MemCache.new mserv, mopts
unless @pool.active? and @pool.servers.any?{|c| c.alive? }
raise 'No memcache servers'
@@ -42,6 +42,11 @@
specify "connect to existing server" do
test_pool = MemCache.new incrementor, :namespace => 'test:rack:session'
end
+
+ specify "pass options to MemCache" do
+ pool = Rack::Session::Memcache.new incrementor, :namespace => 'test:rack:session'
+ pool.pool.namespace.should.equal 'test:rack:session'
+ end
specify "creates a new cookie" do
pool = Rack::Session::Memcache.new(incrementor)

0 comments on commit d1ffcae

Please sign in to comment.