diff options
author | Damien Mathieu <damien@heroku.com> | 2015-03-19 10:06:28 +0100 |
---|---|---|
committer | Damien Mathieu <damien@heroku.com> | 2015-03-19 10:06:28 +0100 |
commit | d578cbfb5c9fa353ce041bc826e13905910e2d2a (patch) | |
tree | 825cabca0569e490290923ea8cb0c6f0a86eef2f /railties/test/commands | |
parent | 7f338b9082fe3488f681c171b93c371cfc951f22 (diff) | |
download | rails-d578cbfb5c9fa353ce041bc826e13905910e2d2a.tar.gz rails-d578cbfb5c9fa353ce041bc826e13905910e2d2a.tar.bz2 rails-d578cbfb5c9fa353ce041bc826e13905910e2d2a.zip |
don't fallback to RACK_ENV when RAILS_ENV is not present
Diffstat (limited to 'railties/test/commands')
-rw-r--r-- | railties/test/commands/console_test.rb | 7 | ||||
-rw-r--r-- | railties/test/commands/dbconsole_test.rb | 5 | ||||
-rw-r--r-- | railties/test/commands/server_test.rb | 63 |
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 |