summaryrefslogtreecommitdiff
path: root/test/webrick/test_httpauth.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/webrick/test_httpauth.rb')
-rw-r--r--test/webrick/test_httpauth.rb29
1 files changed, 3 insertions, 26 deletions
diff --git a/test/webrick/test_httpauth.rb b/test/webrick/test_httpauth.rb
index 7109ebc2cb3..75926b1624f 100644
--- a/test/webrick/test_httpauth.rb
+++ b/test/webrick/test_httpauth.rb
@@ -3,34 +3,11 @@ require "net/http"
require "tempfile"
require "webrick"
require "webrick/httpauth/basicauth"
+require File.join(File.dirname(__FILE__), "utils.rb")
class TestWEBrickHTTPAuth < Test::Unit::TestCase
- class NullWriter
- def NullWriter.<<(msg)
- puts msg if $DEBUG
- return self
- end
- end
-
- def start_httpserver
- server = WEBrick::HTTPServer.new(
- :BindAddress => "0.0.0.0", :Port => 0,
- :Logger => WEBrick::Log.new(NullWriter),
- :AccessLog => [[NullWriter, ""]]
- )
- thread = nil
- begin
- thread = Thread.start{ server.start }
- addr = server.listeners[0].addr
- yield([server, addr[3], addr[1]])
- ensure
- server.stop
- thread.join
- end
- end
-
def test_basic_auth
- start_httpserver{|server, addr, port|
+ TestWEBrick.start_httpserver{|server, addr, port|
realm = "WEBrick's realm"
path = "/basic_auth"
@@ -50,7 +27,7 @@ class TestWEBrickHTTPAuth < Test::Unit::TestCase
end
def test_basic_auth2
- start_httpserver{|server, addr, port|
+ TestWEBrick.start_httpserver{|server, addr, port|
realm = "WEBrick's realm"
path = "/basic_auth2"