aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-02-27 17:29:16 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-02-27 21:32:57 +0900
commit60aeb6a8f9f1fc161a921c2219650c19b6e753e7 (patch)
tree05aadb730d8e1a3d199cd7ad915063ee4f892a2a /railties/test
parent2d84a6bc74fbe9d9b97bf7d63ec6f27418d9c3a6 (diff)
downloadrails-60aeb6a8f9f1fc161a921c2219650c19b6e753e7.tar.gz
rails-60aeb6a8f9f1fc161a921c2219650c19b6e753e7.tar.bz2
rails-60aeb6a8f9f1fc161a921c2219650c19b6e753e7.zip
Set correct host except development environment
Currently `localhost` is used for the default host in all environments. But up to Rails 5.0, `0.0.0.0` is used except for development. So fixed to use the same value as 5.0. Fixes #28184
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/commands/server_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/railties/test/commands/server_test.rb b/railties/test/commands/server_test.rb
index 0f236ff463..d21a80982b 100644
--- a/railties/test/commands/server_test.rb
+++ b/railties/test/commands/server_test.rb
@@ -121,6 +121,24 @@ class Rails::ServerTest < ActiveSupport::TestCase
end
end
+ def test_host
+ with_rails_env "development" do
+ options = parse_arguments([])
+ assert_equal "localhost", options[:Host]
+ end
+
+ with_rails_env "production" do
+ options = parse_arguments([])
+ assert_equal "0.0.0.0", options[:Host]
+ end
+
+ with_rails_env "development" do
+ args = ["-b", "127.0.0.1"]
+ options = parse_arguments(args)
+ assert_equal "127.0.0.1", options[:Host]
+ end
+ end
+
def test_records_user_supplied_options
server_options = parse_arguments(["-p", 3001])
assert_equal [:Port], server_options[:user_supplied_options]