Sha256: 4b967e266513d2ac53ca7c093f4ff5720cc35202ea2f877fb105dff957cbbfdf
Contents?: true
Size: 725 Bytes
Versions: 22
Compression:
Stored size: 725 Bytes
Contents
require 'test/unit' require 'net/http' require 'mongrel' require 'timeout' include Mongrel; class TestHandler < Mongrel::HttpHandler attr_reader :ran_test def process(request, response) @ran_test = true response.socket.write("HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\nhello!\n") end end class WSTest < Test::Unit::TestCase def test_simple_server h = HttpServer.new("0.0.0.0", 9998) tester = TestHandler.new h.register("/test", tester) h.run sleep(1) res = Net::HTTP.get(URI.parse('http://localhost:9998/test')) assert res != nil, "Didn't get a response" assert tester.ran_test, "Handler didn't really run" end end
Version data entries
22 entries across 22 versions & 1 rubygems