aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/commands')
-rw-r--r--railties/test/commands/console_test.rb7
-rw-r--r--railties/test/commands/dbconsole_test.rb5
-rw-r--r--railties/test/commands/server_test.rb63
3 files changed, 19 insertions, 56 deletions
diff --git a/railties/test/commands/console_test.rb b/railties/test/commands/console_test.rb
index de0cf0ba9e..d7614de9e3 100644
--- a/railties/test/commands/console_test.rb
+++ b/railties/test/commands/console_test.rb
@@ -70,13 +70,6 @@ class Rails::ConsoleTest < ActiveSupport::TestCase
end
end
- def test_default_environment_with_rack_env
- with_rack_env 'production' do
- start
- assert_match(/\sproduction\s/, output)
- end
- end
-
def test_e_option
start ['-e', 'special-production']
assert_match(/\sspecial-production\s/, output)
diff --git a/railties/test/commands/dbconsole_test.rb b/railties/test/commands/dbconsole_test.rb
index a3cd1eb0ed..b8c7354ed0 100644
--- a/railties/test/commands/dbconsole_test.rb
+++ b/railties/test/commands/dbconsole_test.rb
@@ -82,20 +82,15 @@ class Rails::DBConsoleTest < ActiveSupport::TestCase
assert_equal "test", Rails::DBConsole.new.environment
ENV['RAILS_ENV'] = nil
- ENV['RACK_ENV'] = nil
Rails.stub(:respond_to?, false) do
assert_equal "development", Rails::DBConsole.new.environment
- ENV['RACK_ENV'] = "rack_env"
- assert_equal "rack_env", Rails::DBConsole.new.environment
-
ENV['RAILS_ENV'] = "rails_env"
assert_equal "rails_env", Rails::DBConsole.new.environment
end
ensure
ENV['RAILS_ENV'] = "test"
- ENV['RACK_ENV'] = nil
end
def test_rails_env_is_development_when_argument_is_dev
diff --git a/railties/test/commands/server_test.rb b/railties/test/commands/server_test.rb
index ba688f1e9e..8427ac1bc2 100644
--- a/railties/test/commands/server_test.rb
+++ b/railties/test/commands/server_test.rb
@@ -27,61 +27,36 @@ class Rails::ServerTest < ActiveSupport::TestCase
end
def test_environment_with_rails_env
- with_rack_env nil do
- with_rails_env 'production' do
- server = Rails::Server.new
- assert_equal 'production', server.options[:environment]
- end
+ with_rails_env 'production' do
+ server = Rails::Server.new
+ assert_equal 'production', server.options[:environment]
end
end
- def test_environment_with_rack_env
+ def test_log_stdout
with_rails_env nil do
- with_rack_env 'production' do
- server = Rails::Server.new
- assert_equal 'production', server.options[:environment]
- end
- end
- end
+ args = []
+ options = Rails::Server::Options.new.parse!(args)
+ assert_equal true, options[:log_stdout]
- def test_log_stdout
- with_rack_env nil do
- with_rails_env nil do
- args = []
- options = Rails::Server::Options.new.parse!(args)
- assert_equal true, options[:log_stdout]
+ args = ["-e", "development"]
+ options = Rails::Server::Options.new.parse!(args)
+ assert_equal true, options[:log_stdout]
- args = ["-e", "development"]
+ args = ["-e", "production"]
+ options = Rails::Server::Options.new.parse!(args)
+ assert_equal false, options[:log_stdout]
+
+ with_rails_env 'development' do
+ args = []
options = Rails::Server::Options.new.parse!(args)
assert_equal true, options[:log_stdout]
+ end
- args = ["-e", "production"]
+ with_rails_env 'production' do
+ args = []
options = Rails::Server::Options.new.parse!(args)
assert_equal false, options[:log_stdout]
-
- with_rack_env 'development' do
- args = []
- options = Rails::Server::Options.new.parse!(args)
- assert_equal true, options[:log_stdout]
- end
-
- with_rack_env 'production' do
- args = []
- options = Rails::Server::Options.new.parse!(args)
- assert_equal false, options[:log_stdout]
- end
-
- with_rails_env 'development' do
- args = []
- options = Rails::Server::Options.new.parse!(args)
- assert_equal true, options[:log_stdout]
- end
-
- with_rails_env 'production' do
- args = []
- options = Rails::Server::Options.new.parse!(args)
- assert_equal false, options[:log_stdout]
- end
end
end
end