summaryrefslogtreecommitdiff
path: root/test/xmlrpc/webrick_testing.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-09 09:36:33 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-09 09:36:33 +0000
commit5ab3fe5fb5fd5d501665860843b8017a47af1109 (patch)
tree20207a27f0a370faaf0aab3ade7704d1ef3f59a7 /test/xmlrpc/webrick_testing.rb
parent62b511b6aa9e2c1ceb11048f012eed13e5feabfb (diff)
* test/xmlrpc: Refine log test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/xmlrpc/webrick_testing.rb')
-rw-r--r--test/xmlrpc/webrick_testing.rb19
1 files changed, 9 insertions, 10 deletions
diff --git a/test/xmlrpc/webrick_testing.rb b/test/xmlrpc/webrick_testing.rb
index cfbaba07d9a..37c0b69a740 100644
--- a/test/xmlrpc/webrick_testing.rb
+++ b/test/xmlrpc/webrick_testing.rb
@@ -2,21 +2,14 @@ require 'timeout'
module TestXMLRPC
module WEBrick_Testing
- empty_log = Object.new
- def empty_log.<<(str)
- assert_equal('', str)
- self
- end
- NoLog = WEBrick::Log.new(empty_log, WEBrick::BasicLog::WARN)
-
- def start_server(config={})
+ def start_server(logger, config={})
raise "already started" if defined?(@__server) && @__server
@__started = false
@__server = WEBrick::HTTPServer.new(
{
:BindAddress => "localhost",
- :Logger => NoLog,
+ :Logger => logger,
:AccessLog => [],
}.update(config))
yield @__server
@@ -38,7 +31,12 @@ module WEBrick_Testing
end
def with_server(config, servlet)
- addr = start_server(config) {|w| w.mount('/RPC2', create_servlet) }
+ log = []
+ logger = WEBrick::Log.new(log, WEBrick::BasicLog::WARN)
+ addr = start_server(logger, config) {|w|
+ servlet = servlet.call(w) if servlet.respond_to? :call
+ w.mount('/RPC2', servlet)
+ }
client_thread = Thread.new {
begin
yield addr
@@ -49,6 +47,7 @@ module WEBrick_Testing
server_thread = Thread.new {
@__server_thread.join
@__server = nil
+ assert_equal([], log)
}
assert_join_threads([client_thread, server_thread])
end