diff options
author | Ian Ownbey <imownbey@gmail.com> | 2008-11-22 14:15:54 -0800 |
---|---|---|
committer | Ian Ownbey <imownbey@gmail.com> | 2008-11-22 14:15:54 -0800 |
commit | e25b558ba8d2d6812d490b365539c2a7bf219e12 (patch) | |
tree | b138a880fbd40b2472818fc129baf89697678462 | |
parent | 559edfb1fbf18e9496a4235831fd49c5b0d8b459 (diff) | |
download | unicorn-e25b558ba8d2d6812d490b365539c2a7bf219e12.tar.gz |
-rw-r--r-- | .gitignore | 9 | ||||
-rw-r--r-- | test/unit/test_ws.rb | 15 |
2 files changed, 17 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2658b88 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +ext/http11/Makefile +ext/http11/http11.bundle +ext/http11/http11.o +ext/http11/http11_parser.o +ext/http11/mkmf.log +lib/http11.bundle +log/ +test_stderr.log +test_stdout.log diff --git a/test/unit/test_ws.rb b/test/unit/test_ws.rb index 9de8a45..036752a 100644 --- a/test/unit/test_ws.rb +++ b/test/unit/test_ws.rb @@ -8,13 +8,14 @@ require 'test/test_helper' include Mongrel -class TestHandler < Mongrel::HttpHandler +class TestHandler attr_reader :ran_test - def process(request, response) + def call(env) @ran_test = true - response.socket.write("HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\nhello!\n") - end + # response.socket.write("HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\nhello!\n") + [200, { 'Content-Type' => 'text/plain' }, ['hello!\n']] + end end @@ -23,13 +24,13 @@ class WebServerTest < Test::Unit::TestCase def setup @valid_request = "GET / HTTP/1.1\r\nHost: www.zedshaw.com\r\nContent-Type: text/plain\r\n\r\n" @port = process_based_port - + @tester = TestHandler.new + @app = Rack::URLMap.new('/test' => @tester) redirect_test_io do # We set num_processors=1 so that we can test the reaping code - @server = HttpServer.new("127.0.0.1", @port, num_processors=1) + @server = HttpServer.new("127.0.0.1", @port, @app, :num_processors => 1) end - @tester = TestHandler.new @server.register("/test", @tester) redirect_test_io do @server.run |