diff options
author | Yuji Yaginuma <yuuji.yaginuma@gmail.com> | 2018-04-16 14:35:13 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-16 14:35:13 +0900 |
commit | 37b373a8d2a1cd132bbde51cd5a3abd4ecee433b (patch) | |
tree | 251b0e592cb53b15b835aea95d88466d04cc65a0 /railties/test | |
parent | d472229f1fb76f73b6bc678191057a554ce52f51 (diff) | |
download | rails-37b373a8d2a1cd132bbde51cd5a3abd4ecee433b.tar.gz rails-37b373a8d2a1cd132bbde51cd5a3abd4ecee433b.tar.bz2 rails-37b373a8d2a1cd132bbde51cd5a3abd4ecee433b.zip |
Deprecate support for using `HOST` environment to specify server IP (#32540)
At SuSE, `$HOST` is set by default and is equal to `$HOSTNAME`.
https://www.suse.com/documentation/sled11/book_sle_admin/data/sec_adm_variables.html
Therefore, by default, it binds to hostname instead of `localhost`.
This seems not to be appropriate as default behavior.
In order to avoid the name of the environment variable being used,
I changed the environment variable from `HOST` to `BINDING`.
Fixes #29516.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/commands/server_test.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/railties/test/commands/server_test.rb b/railties/test/commands/server_test.rb index bdaab477f1..e7a56b3e6d 100644 --- a/railties/test/commands/server_test.rb +++ b/railties/test/commands/server_test.rb @@ -90,6 +90,15 @@ class Rails::Command::ServerCommandTest < ActiveSupport::TestCase def test_environment_with_host switch_env "HOST", "1.2.3.4" do + assert_deprecated do + options = parse_arguments + assert_equal "1.2.3.4", options[:Host] + end + end + end + + def test_environment_with_binding + switch_env "BINDING", "1.2.3.4" do options = parse_arguments assert_equal "1.2.3.4", options[:Host] end @@ -196,7 +205,7 @@ class Rails::Command::ServerCommandTest < ActiveSupport::TestCase assert_equal 3000, options[:Port] end - switch_env "HOST", "1.2.3.4" do + switch_env "BINDING", "1.2.3.4" do args = ["-b", "127.0.0.1"] options = parse_arguments(args) assert_equal "127.0.0.1", options[:Host] @@ -215,6 +224,11 @@ class Rails::Command::ServerCommandTest < ActiveSupport::TestCase server_options = parse_arguments(["--port=3001"]) assert_equal [:Port], server_options[:user_supplied_options] + + switch_env "BINDING", "1.2.3.4" do + server_options = parse_arguments + assert_equal [:Host], server_options[:user_supplied_options] + end end def test_default_options |