about summary refs log tree commit homepage
path: root/test/unit/test_ws.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/test_ws.rb')
-rw-r--r--test/unit/test_ws.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/unit/test_ws.rb b/test/unit/test_ws.rb
index 68a79a8..9de8a45 100644
--- a/test/unit/test_ws.rb
+++ b/test/unit/test_ws.rb
@@ -22,10 +22,11 @@ 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
     
     redirect_test_io do
       # We set num_processors=1 so that we can test the reaping code
-      @server = HttpServer.new("127.0.0.1", 9998, num_processors=1)
+      @server = HttpServer.new("127.0.0.1", @port, num_processors=1)
     end
     
     @tester = TestHandler.new
@@ -42,14 +43,14 @@ class WebServerTest < Test::Unit::TestCase
   end
 
   def test_simple_server
-    hit(['http://localhost:9998/test'])
+    hit(["http://localhost:#{@port}/test"])
     assert @tester.ran_test, "Handler didn't really run"
   end
 
 
   def do_test(string, chunk, close_after=nil, shutdown_delay=0)
     # Do not use instance variables here, because it needs to be thread safe
-    socket = TCPSocket.new("127.0.0.1", 9998);
+    socket = TCPSocket.new("127.0.0.1", @port);
     request = StringIO.new(string)
     chunks_out = 0