module TestWebServer mattr_accessor :server def self.start TestWebServer.server = Thread.new { app = proc { [200, {'Content-Type' => 'text/plain'}, ['Test']] } Rack::Handler::Thin.run(app,:Port => 3001) } puts "Starting Test Webserver" sleep 2 end def self.stop Thread.kill(TestWebServer.server) puts "Stopping Test Webserver" end end