aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorYuji Yaginuma <yuuji.yaginuma@gmail.com>2019-06-20 11:52:21 +0900
committerGitHub <noreply@github.com>2019-06-20 11:52:21 +0900
commitbf625f7fecabbcda22b388e088ad5c29016b2385 (patch)
tree94cb86b179fb5bd905e7fd68e37af271c2dd0529 /railties/test
parent8a20a40fef066ef52571f0c30aee92dd0fa36e15 (diff)
parent2e5ec9a6efc80fd266b974fc50b2775afa73130b (diff)
downloadrails-bf625f7fecabbcda22b388e088ad5c29016b2385.tar.gz
rails-bf625f7fecabbcda22b388e088ad5c29016b2385.tar.bz2
rails-bf625f7fecabbcda22b388e088ad5c29016b2385.zip
Merge pull request #36486 from benthorner/master
Allow using env var to specify pidfile
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/commands/server_test.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/railties/test/commands/server_test.rb b/railties/test/commands/server_test.rb
index b78370a233..c9026e2d95 100644
--- a/railties/test/commands/server_test.rb
+++ b/railties/test/commands/server_test.rb
@@ -116,6 +116,13 @@ class Rails::Command::ServerCommandTest < ActiveSupport::TestCase
end
end
+ def test_environment_with_pidfile
+ switch_env "PIDFILE", "/tmp/rails.pid" do
+ options = parse_arguments
+ assert_equal "/tmp/rails.pid", options[:pid]
+ end
+ end
+
def test_caching_without_option
args = []
options = parse_arguments(args)
@@ -234,6 +241,12 @@ class Rails::Command::ServerCommandTest < ActiveSupport::TestCase
options = parse_arguments(args)
assert_equal "127.0.0.1", options[:Host]
end
+
+ switch_env "PIDFILE", "/tmp/rails.pid" do
+ args = ["-P", "/somewhere/else.pid"]
+ options = parse_arguments(args)
+ assert_equal "/somewhere/else.pid", options[:pid]
+ end
end
def test_records_user_supplied_options
@@ -253,6 +266,16 @@ class Rails::Command::ServerCommandTest < ActiveSupport::TestCase
server_options = parse_arguments
assert_equal [:Host], server_options[:user_supplied_options]
end
+
+ switch_env "PORT", "3001" do
+ server_options = parse_arguments
+ assert_equal [:Port], server_options[:user_supplied_options]
+ end
+
+ switch_env "PIDFILE", "/tmp/server.pid" do
+ server_options = parse_arguments
+ assert_equal [:pid], server_options[:user_supplied_options]
+ end
end
def test_default_options