diff options
author | Jon Moss <me@jonathanmoss.me> | 2017-03-21 19:07:40 -0400 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2017-03-21 19:07:40 -0400 |
commit | d0accc23b3d01a7d35e73c5dc901014d883ef5f7 (patch) | |
tree | 9c344c7ee7abd7a5bb0a009c86b9b1b8b31ee28d /railties/test/commands | |
parent | 88b16843f67bcd96395444ba8f139895351da0bc (diff) | |
download | rails-d0accc23b3d01a7d35e73c5dc901014d883ef5f7.tar.gz rails-d0accc23b3d01a7d35e73c5dc901014d883ef5f7.tar.bz2 rails-d0accc23b3d01a7d35e73c5dc901014d883ef5f7.zip |
CLI arg "host" has precedence over ENV var "host"
This is a regression from when the server command switched to its own
argument parser, as opposed to Rack's. Rack's argument parser, when
provided with a "host" argument, gives that value precedence over
environment variables.
Diffstat (limited to 'railties/test/commands')
-rw-r--r-- | railties/test/commands/server_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/railties/test/commands/server_test.rb b/railties/test/commands/server_test.rb index d21a80982b..2d1f071969 100644 --- a/railties/test/commands/server_test.rb +++ b/railties/test/commands/server_test.rb @@ -139,6 +139,14 @@ class Rails::ServerTest < ActiveSupport::TestCase end end + def test_argument_precedence_over_environment_variable + switch_env "HOST", "1.2.3.4" 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] |