test/test_helper.rb in evdispatch-0.4.1 vs test/test_helper.rb in evdispatch-0.4.2

- old
+ new

@@ -2,5 +2,31 @@ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..','ext','revdispatch')) $:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..','lib')) require 'evdispatch' + +class TestServer + def self.setup + if !defined?($server_task) + require 'rubygems' + require 'daemons' + + # start up the test server + require File.expand_path(File.join(File.dirname(__FILE__), '..','ext','revdispatch','server')) + $server_task = Daemons.call do + $daemonized = true + begin + require 'ebb' + Ebb.start_server(TestApp.new, :port => TEST_PORT) + rescue LoadError => e + Rack::Handler::Mongrel.run(TestApp.new, :Port => TEST_PORT ) + end + end + sleep(0.5) # wait for the server to start up + + at_exit { + $server_task.stop + } + end + end +end