mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
5a8f25f003
This cleanup aims to fix a build failure: https://travis-ci.org/rails/rails/jobs/3515951/#L482 Since travis always have both ENV vars set to "test", a test is failing where it's expected to output the default env "development", but "test" is the result due to RACK_ENV being set when we expect it to not be. By cleaning this duplication we ensure that changing any of these env variables will pick the right expected value.
42 lines
1.2 KiB
Ruby
42 lines
1.2 KiB
Ruby
require 'abstract_unit'
|
|
require 'env_helpers'
|
|
require 'rails/commands/server'
|
|
|
|
class Rails::ServerTest < ActiveSupport::TestCase
|
|
include EnvHelpers
|
|
|
|
def test_environment_with_server_option
|
|
args = ["thin", "-e", "production"]
|
|
options = Rails::Server::Options.new.parse!(args)
|
|
assert_equal 'production', options[:environment]
|
|
assert_equal 'thin', options[:server]
|
|
end
|
|
|
|
def test_environment_without_server_option
|
|
args = ["-e", "production"]
|
|
options = Rails::Server::Options.new.parse!(args)
|
|
assert_equal 'production', options[:environment]
|
|
assert_nil options[:server]
|
|
end
|
|
|
|
def test_server_option_without_environment
|
|
args = ["thin"]
|
|
options = Rails::Server::Options.new.parse!(args)
|
|
assert_nil options[:environment]
|
|
assert_equal 'thin', options[:server]
|
|
end
|
|
|
|
def test_environment_with_rails_env
|
|
with_rails_env 'production' do
|
|
server = Rails::Server.new
|
|
assert_equal 'production', server.options[:environment]
|
|
end
|
|
end
|
|
|
|
def test_environment_with_rack_env
|
|
with_rack_env 'production' do
|
|
server = Rails::Server.new
|
|
assert_equal 'production', server.options[:environment]
|
|
end
|
|
end
|
|
end
|