From 6bcf7098384e96bc756356ee08bc0dd92584244f Mon Sep 17 00:00:00 2001 From: naruse Date: Wed, 12 Jan 2011 00:37:12 +0000 Subject: * test/webrick/test_cgi.rb: Removes usage of deprecated :RequestHandler option. patched by Peter Weldon [ruby-core:34010] * test/webrick/test_httpproxy.rb: ditto. * test/webrick/test_httpserver.rb: Add a test of the deprecation behaviour. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/webrick/test_httpserver.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/webrick/test_httpserver.rb') 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 -- cgit v1.2.3