about summary refs log tree commit homepage
path: root/test/test_serve_static.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2013-10-26 01:58:34 +0000
committerEric Wong <normalperson@yhbt.net>2013-10-26 02:00:17 +0000
commit5d5377e094745ee76cd066d2244c52b40647d1cc (patch)
tree128abda8eeb7f096f57d6596e5622cfb9aadda46 /test/test_serve_static.rb
parent14b21f7a162c6f4e76d00d6d08fa9a09524997ae (diff)
downloadyahns-5d5377e094745ee76cd066d2244c52b40647d1cc.tar.gz
This reduces the amount of code we have in our tests to
improve maintainability.
Diffstat (limited to 'test/test_serve_static.rb')
-rw-r--r--test/test_serve_static.rb10
1 files changed, 2 insertions, 8 deletions
diff --git a/test/test_serve_static.rb b/test/test_serve_static.rb
index 95c07bc..6cb337e 100644
--- a/test/test_serve_static.rb
+++ b/test/test_serve_static.rb
@@ -19,11 +19,7 @@ class TestServeStatic < Testcase
       end
       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)
     gplv3 = File.read("COPYING")
     Net::HTTP.start(host, port) do |http|
       res = http.request(Net::HTTP::Get.new("/COPYING"))
@@ -47,12 +43,10 @@ class TestServeStatic < Testcase
       end
       logger(Logger.new(err.path))
     end
-    pid = fork do
-      ENV["YAHNS_FD"] = @srv.fileno.to_s
+    pid = mkserver(cfg) do
       $_tw_blocked = 0
       $_tw_block_on = [1]
       Yahns::HttpClient.__send__(:include, TrywriteBlocked)
-      Yahns::Server.new(cfg).start.join
     end
     gplv3 = File.read("COPYING")
     Net::HTTP.start(host, port) do |http|