aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorAndrew White <pixeltrix@users.noreply.github.com>2017-02-27 14:49:48 +0000
committerGitHub <noreply@github.com>2017-02-27 14:49:48 +0000
commit4cc1c14493e7a9bd188ee13c237366f6bc2e13f4 (patch)
treebd35340815db8a4def83ff759d9bddf50c305625 /railties/test
parent0bd325e5efc907ee4eade0c449c1635027ec5e6a (diff)
parent60aeb6a8f9f1fc161a921c2219650c19b6e753e7 (diff)
downloadrails-4cc1c14493e7a9bd188ee13c237366f6bc2e13f4.tar.gz
rails-4cc1c14493e7a9bd188ee13c237366f6bc2e13f4.tar.bz2
rails-4cc1c14493e7a9bd188ee13c237366f6bc2e13f4.zip
Merge pull request #28196 from y-yagi/set_correct_host_except_development_environment
Set correct host except development environment
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]