test/test_rack_hijack.rb in yahns-0.0.1 vs test/test_rack_hijack.rb in yahns-0.0.2

- old
+ new

@@ -1,11 +1,11 @@ # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require_relative 'server_helper' class TestRackHijack < Testcase - parallelize_me! + ENV["N"].to_i > 1 and parallelize_me! include ServerHelper alias setup server_helper_setup alias teardown server_helper_teardown class DieIfUsed @@ -51,14 +51,10 @@ host, port = @srv.addr[3], @srv.addr[1] cfg.instance_eval do GTL.synchronize { app(:rack, HIJACK_APP) { listen "#{host}:#{port}" } } logger(Logger.new(err.path)) end - srv = Yahns::Server.new(cfg) - pid = fork do - ENV["YAHNS_FD"] = @srv.fileno.to_s - srv.start.join - end + pid = mkserver(cfg) res = Net::HTTP.start(host, port) { |h| h.get("/hijack_req") } assert_equal "request.hijacked", res.body assert_equal 200, res.code.to_i assert_equal "1.0", res.http_version