summaryrefslogtreecommitdiff
path: root/test/webrick
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-07 12:59:48 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-07 12:59:48 +0000
commit03ec73972939ad068304ac6f33759a815da14690 (patch)
treeaa84d8f5b2ed133c0b69180b409259c91c5a6669 /test/webrick
parent8d879ca30594593cd37929ffc5883afd41c3c1d8 (diff)
Delay Utils.getservername until needed.
There is no need to call Utils.getservername when the :ServerName option is specified, so delay Utils.getservername until needed to avoid unnecessary DNS lookups. [ruby-core:78492] [Bug #13007] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/webrick')
-rw-r--r--test/webrick/test_config.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/webrick/test_config.rb b/test/webrick/test_config.rb
new file mode 100644
index 0000000000..a54a667452
--- /dev/null
+++ b/test/webrick/test_config.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: false
+require "test/unit"
+require "webrick/config"
+
+class TestWEBrickConfig < Test::Unit::TestCase
+ def test_server_name_default
+ config = WEBrick::Config::General.dup
+ assert_equal(false, config.key?(:ServerName))
+ assert_equal(WEBrick::Utils.getservername, config[:ServerName])
+ assert_equal(true, config.key?(:ServerName))
+ end
+
+ def test_server_name_set_nil
+ config = WEBrick::Config::General.dup.update(ServerName: nil)
+ assert_equal(nil, config[:ServerName])
+ end
+end