aboutsummaryrefslogtreecommitdiffstats
path: root/test/webrick/test_httpserver.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-09 14:01:20 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-09 14:01:20 +0000
commitad58f04833b6d9f6b0d01c5fc8adc61df6d088cc (patch)
treef2484838869a97b049adf8b1f487513f5554569c /test/webrick/test_httpserver.rb
parent0d07bc203c421e9ebda8ef3ae50230f6b1866a71 (diff)
downloadruby-ad58f04833b6d9f6b0d01c5fc8adc61df6d088cc.tar.gz
* test/open-uri: Test server log in server thread.
* test/webrick: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/webrick/test_httpserver.rb')
-rw-r--r--test/webrick/test_httpserver.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/test/webrick/test_httpserver.rb b/test/webrick/test_httpserver.rb
index eae77ec9ba..5cd4ba5866 100644
--- a/test/webrick/test_httpserver.rb
+++ b/test/webrick/test_httpserver.rb
@@ -230,7 +230,11 @@ class TestWEBrickHTTPServer < Test::Unit::TestCase
:StopCallback => Proc.new{ stopped += 1 },
:RequestCallback => Proc.new{|req, res| requested0 += 1 },
}
- TestWEBrick.start_httpserver(config){|server, addr, port, log|
+ log_tester = lambda {|log, access_log|
+ assert(log.find {|s| %r{ERROR `/' not found\.} =~ s })
+ assert_equal([], log.reject {|s| %r{ERROR `/' not found\.} =~ s })
+ }
+ TestWEBrick.start_httpserver(config, log_tester){|server, addr, port, log|
vhost_config = {
:ServerName => "myhostname",
:BindAddress => addr,
@@ -333,7 +337,11 @@ class TestWEBrickHTTPServer < Test::Unit::TestCase
config = {
:ServerName => "localhost"
}
- TestWEBrick.start_httpserver(config){|server, addr, port, log|
+ log_tester = lambda {|log, access_log|
+ assert_equal(1, log.length)
+ assert_match(/WARN Could not determine content-length of response body./, log[0])
+ }
+ TestWEBrick.start_httpserver(config, log_tester){|server, addr, port, log|
server.mount_proc("/", lambda { |req, res|
r,w = IO.pipe
# Test for not setting chunked...
@@ -362,7 +370,12 @@ class TestWEBrickHTTPServer < Test::Unit::TestCase
:ServerName => "localhost",
:RequestHandler => Proc.new{|req, res| requested += 1 },
}
- TestWEBrick.start_httpserver(config){|server, addr, port, log|
+ log_tester = lambda {|log, access_log|
+ assert_equal(2, log.length)
+ assert_match(/WARN :RequestHandler is deprecated, please use :RequestCallback/, log[0])
+ assert_match(%r{ERROR `/' not found\.}, log[1])
+ }
+ TestWEBrick.start_httpserver(config, log_tester){|server, addr, port, log|
Thread.pass while server.status != :Running
http = Net::HTTP.new(addr, port)