aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands/server_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/commands/server_test.rb')
-rw-r--r--railties/test/commands/server_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/railties/test/commands/server_test.rb b/railties/test/commands/server_test.rb
index 4a3ea82e3d..6a75207ebb 100644
--- a/railties/test/commands/server_test.rb
+++ b/railties/test/commands/server_test.rb
@@ -23,4 +23,24 @@ class Rails::ServerTest < ActiveSupport::TestCase
assert_nil options[:environment]
assert_equal 'thin', options[:server]
end
+
+ def test_environment_with_rails_env
+ rails = ENV['RAILS_ENV']
+ ENV['RAILS_ENV'] = 'production'
+ server = Rails::Server.new
+ assert_equal 'production', server.options[:environment]
+ ensure
+ ENV['RAILS_ENV'] = rails
+ end
+
+ def test_environment_with_rack_env
+ rack, rails = ENV['RACK_ENV'], ENV['RAILS_ENV']
+ ENV['RAILS_ENV'] = nil
+ ENV['RACK_ENV'] = 'production'
+ server = Rails::Server.new
+ assert_equal 'production', server.options[:environment]
+ ensure
+ ENV['RACK_ENV'] = rack
+ ENV['RAILS_ENV'] = rails
+ end
end