2012-03-20 19:28:30 -04:00
|
|
|
require 'abstract_unit'
|
|
|
|
require 'rails/commands/server'
|
|
|
|
|
|
|
|
class Rails::ServerTest < ActiveSupport::TestCase
|
|
|
|
|
|
|
|
def test_environment_with_server_option
|
2012-05-15 05:37:54 -04:00
|
|
|
args = ["thin", "-e", "production"]
|
2012-03-20 19:28:30 -04:00
|
|
|
options = Rails::Server::Options.new.parse!(args)
|
|
|
|
assert_equal 'production', options[:environment]
|
|
|
|
assert_equal 'thin', options[:server]
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_environment_without_server_option
|
2012-05-15 05:37:54 -04:00
|
|
|
args = ["-e", "production"]
|
2012-03-20 19:28:30 -04:00
|
|
|
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
|
|
|
|
end
|