aboutsummaryrefslogtreecommitdiffstats
path: root/test/webrick/test_httpserver.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/webrick/test_httpserver.rb')
-rw-r--r--test/webrick/test_httpserver.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/webrick/test_httpserver.rb b/test/webrick/test_httpserver.rb
index e0c2ae33ad..b4bdd84045 100644
--- a/test/webrick/test_httpserver.rb
+++ b/test/webrick/test_httpserver.rb
@@ -257,4 +257,22 @@ class TestWEBrickHTTPServer < Test::Unit::TestCase
assert_equal(started, 1)
assert_equal(stopped, 1)
end
+
+ def test_request_handler_callback_is_deprecated
+ requested = 0
+ config = {
+ :ServerName => "localhost",
+ :RequestHandler => Proc.new{|req, res| requested += 1 },
+ }
+ TestWEBrick.start_httpserver(config){|server, addr, port, log|
+ true while server.status != :Running
+
+ http = Net::HTTP.new(addr, port)
+ req = Net::HTTP::Get.new("/")
+ req["Host"] = "localhost:#{port}"
+ http.request(req){|res| assert_equal("404", res.code, log.call)}
+ assert_match(%r{:RequestHandler is deprecated, please use :RequestCallback$}, log.call, log.call)
+ }
+ assert_equal(requested, 1)
+ end
end