diff options
author | koshigoe <koshigoeb@gmail.com> | 2017-05-01 17:05:49 +0900 |
---|---|---|
committer | koshigoe <koshigoeb@gmail.com> | 2017-05-01 21:28:47 +0900 |
commit | c0928831697306c0a92d5e71f35e8e060a59907b (patch) | |
tree | bea1d90a9a636444f40869a21014f1c741768cc6 /railties/test/commands | |
parent | 7cb71c5ce37b7bc599de851d44eaa6a948daec03 (diff) | |
download | rails-c0928831697306c0a92d5e71f35e8e060a59907b.tar.gz rails-c0928831697306c0a92d5e71f35e8e060a59907b.tar.bz2 rails-c0928831697306c0a92d5e71f35e8e060a59907b.zip |
CLI arg `--port` has precedence over env `PORT`.
Diffstat (limited to 'railties/test/commands')
-rw-r--r-- | railties/test/commands/server_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/railties/test/commands/server_test.rb b/railties/test/commands/server_test.rb index 2d1f071969..7731d10d9b 100644 --- a/railties/test/commands/server_test.rb +++ b/railties/test/commands/server_test.rb @@ -140,6 +140,18 @@ class Rails::ServerTest < ActiveSupport::TestCase end def test_argument_precedence_over_environment_variable + switch_env "PORT", "1234" do + args = ["-p", "5678"] + options = parse_arguments(args) + assert_equal 5678, options[:Port] + end + + switch_env "PORT", "1234" do + args = ["-p", "3000"] + options = parse_arguments(args) + assert_equal 3000, options[:Port] + end + switch_env "HOST", "1.2.3.4" do args = ["-b", "127.0.0.1"] options = parse_arguments(args) |