summaryrefslogtreecommitdiff
path: root/test/webrick/utils.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-09 11:51:06 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-09 11:51:06 +0000
commit070c310e87d04865da1b4f217432e22cfae5e380 (patch)
treed11d9ef6c67b447bc886182b9c02e38aa70a3a00 /test/webrick/utils.rb
parent9b559f194c9960e66011b8f40d428fe36cb302be (diff)
* test/webrick: Store log in an array.
* test/net/http: Ditto. * test/open-uri: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/webrick/utils.rb')
-rw-r--r--test/webrick/utils.rb14
1 files changed, 5 insertions, 9 deletions
diff --git a/test/webrick/utils.rb b/test/webrick/utils.rb
index b15ef9a..e1c2344 100644
--- a/test/webrick/utils.rb
+++ b/test/webrick/utils.rb
@@ -32,17 +32,13 @@ module TestWEBrick
module_function
def start_server(klass, config={}, &block)
- log_string = ""
- logger = Object.new
- logger.instance_eval do
- define_singleton_method(:<<) {|msg| log_string << msg }
- end
- log = proc { "webrick log start:\n" + log_string.gsub(/^/, " ").chomp + "\nwebrick log end" }
+ log_ary = []
+ log = proc { "webrick log start:\n" + log_ary.join.gsub(/^/, " ").chomp + "\nwebrick log end" }
server = klass.new({
:BindAddress => "127.0.0.1", :Port => 0,
:ServerType => Thread,
- :Logger => WEBrick::Log.new(logger, WEBrick::BasicLog::WARN),
- :AccessLog => [[logger, ""]]
+ :Logger => WEBrick::Log.new(log_ary, WEBrick::BasicLog::WARN),
+ :AccessLog => [[log_ary, ""]]
}.update(config))
server_thread = server.start
addr = server.listeners[0].addr
@@ -54,7 +50,7 @@ module TestWEBrick
end
}
assert_join_threads([client_thread, server_thread])
- log_string
+ log_ary
end
def start_httpserver(config={}, &block)