summaryrefslogtreecommitdiff
path: root/test/xmlrpc/webrick_testing.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-09 09:07:41 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-09 09:07:41 +0000
commitb30ff6839db848efafc4b7b61abed0e2708d2627 (patch)
tree49c5d6117186319a90b65773b221904882029dfb /test/xmlrpc/webrick_testing.rb
parenta4b5982b4c95b0c6779748bf010aa7445714f343 (diff)
* test/xmlrpc: Use assert_join_threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/xmlrpc/webrick_testing.rb')
-rw-r--r--test/xmlrpc/webrick_testing.rb22
1 files changed, 14 insertions, 8 deletions
diff --git a/test/xmlrpc/webrick_testing.rb b/test/xmlrpc/webrick_testing.rb
index e2a0c3f1334..cfbaba07d9a 100644
--- a/test/xmlrpc/webrick_testing.rb
+++ b/test/xmlrpc/webrick_testing.rb
@@ -37,14 +37,20 @@ module WEBrick_Testing
addr
end
- def stop_server
- return if !defined?(@__server) || !@__server
- Timeout.timeout(5) {
- @__server.shutdown
- Thread.pass while @__started # wait until the server is down
- }
- @__server_thread.join
- @__server = nil
+ def with_server(config, servlet)
+ addr = start_server(config) {|w| w.mount('/RPC2', create_servlet) }
+ client_thread = Thread.new {
+ begin
+ yield addr
+ ensure
+ @__server.shutdown
+ end
+ }
+ server_thread = Thread.new {
+ @__server_thread.join
+ @__server = nil
+ }
+ assert_join_threads([client_thread, server_thread])
end
end
end