aboutsummaryrefslogtreecommitdiffstats
path: root/test/webrick/test_httpserver.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-12 00:37:12 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-12 00:37:12 +0000
commit6bcf7098384e96bc756356ee08bc0dd92584244f (patch)
treeb0aebcf6b4282e866b0641d4e769760724c1a713 /test/webrick/test_httpserver.rb
parent23733f1014b4f3e8445a2f5606085a554e026668 (diff)
downloadruby-6bcf7098384e96bc756356ee08bc0dd92584244f.tar.gz
* 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
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