summaryrefslogtreecommitdiff
path: root/test/xmlrpc/webrick_testing.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-16 02:41:11 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-16 02:41:11 +0000
commite2bb529c8f77a1a2911b13f1949c8813ee29f740 (patch)
tree004c8510182e620692051a84f1ee34e276a5107a /test/xmlrpc/webrick_testing.rb
parentb14c93e6caafe9f8eef40e0912a61284c16ed6ec (diff)
* lib/xmlrpc.rb, lib/xmlrpc/*, test/xmlrpc: XMLRPC is bundled gem
on Ruby 2.4. [Feature #12160][ruby-core:74239] * gems/bundled_gems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/xmlrpc/webrick_testing.rb')
-rw-r--r--test/xmlrpc/webrick_testing.rb61
1 files changed, 0 insertions, 61 deletions
diff --git a/test/xmlrpc/webrick_testing.rb b/test/xmlrpc/webrick_testing.rb
deleted file mode 100644
index 7a3325df3c3..00000000000
--- a/test/xmlrpc/webrick_testing.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-# frozen_string_literal: false
-require 'timeout'
-
-module TestXMLRPC
-module WEBrick_Testing
- def teardown
- WEBrick::Utils::TimeoutHandler.terminate
- super
- end
-
- def start_server(logger, config={})
- raise "already started" if defined?(@__server) && @__server
- @__started = false
-
- @__server = WEBrick::HTTPServer.new(
- {
- :BindAddress => "localhost",
- :Logger => logger,
- :AccessLog => [],
- }.update(config))
- yield @__server
- @__started = true
-
- addr = @__server.listeners.first.connect_address
-
- @__server_thread = Thread.new {
- begin
- @__server.start
- rescue IOError => e
- assert_match(/closed/, e.message)
- ensure
- @__started = false
- end
- }
-
- addr
- end
-
- def with_server(config, 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
- ensure
- @__server.shutdown
- end
- }
- server_thread = Thread.new {
- @__server_thread.join
- @__server = nil
- assert_equal([], log)
- }
- assert_join_threads([client_thread, server_thread])
- end
-end
-end