Created
November 23, 2008 03:19
-
-
Save imownbey/28019 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, @app, :num_processors => 1) | |
@server.start! | |
end | |
end | |
def teardown | |
redirect_test_io do | |
@server.stop(true) | |
end | |
end | |
def test_simple_server | |
hit(["http://localhost:#{@port}/test"]) | |
assert @tester.ran_test, "Handler didn't really run" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment