Permalink
Browse files

Make memcache tests start and kill memcached itself

  • Loading branch information...
1 parent abcaaf4 commit f5d2c1d6354fa28d39af57a963a00a6ef28b8981 @chneukirchen committed Aug 9, 2008
Showing with 14 additions and 0 deletions.
  1. +14 −0 test/spec_rack_session_memcache.rb
@@ -13,6 +13,14 @@
Rack::Response.new(env["rack.session"].inspect).to_a
}
+ # Keep this first.
+ specify "startup" do
+ $pid = fork {
+ exec "memcached"
+ }
+ sleep 1
+ end
+
specify "faults on no connection" do
lambda do
Rack::Session::Memcache.new(incrementor, :memcache_server => '')
@@ -112,6 +120,12 @@
session['counter'].should.be.nil?
session['foo'].should.equal 'bar'
end
+
+ # Keep this last.
+ specify "shutdown" do
+ Process.kill 15, $pid
+ Process.wait($pid).should.equal $pid
+ end
end
rescue LoadError
$stderr.puts "Skipping Rack::Session::Memcache tests (Memcache is required). `gem install memcache-client` and try again."

0 comments on commit f5d2c1d

Please sign in to comment.