Skip to content

Commit

Permalink
updated Session::Memcache initialization to pass MemCache options cor…
Browse files Browse the repository at this point in the history
…rectly

Signed-off-by: Christian Neukirchen <chneukirchen@gmail.com>
  • Loading branch information
Simon Chiang authored and leahneukirchen committed May 7, 2010
1 parent a38b0ae commit d1ffcae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rack/session/memcache.rb
Expand Up @@ -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'
Expand Down
5 changes: 5 additions & 0 deletions test/spec_rack_session_memcache.rb
Expand Up @@ -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)
Expand Down

0 comments on commit d1ffcae

Please sign in to comment.