aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands/console_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/commands/console_test.rb')
-rw-r--r--railties/test/commands/console_test.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/railties/test/commands/console_test.rb b/railties/test/commands/console_test.rb
index f99ea13022..4062905c16 100644
--- a/railties/test/commands/console_test.rb
+++ b/railties/test/commands/console_test.rb
@@ -78,6 +78,13 @@ class Rails::ConsoleTest < ActiveSupport::TestCase
assert_match(/\sspecial-production\s/, output)
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']
@@ -128,10 +135,18 @@ class Rails::ConsoleTest < ActiveSupport::TestCase
end
def with_rails_env(env)
- original_rails_env = ENV['RAILS_ENV']
+ rails = ENV['RAILS_ENV']
ENV['RAILS_ENV'] = env
yield
ensure
- ENV['RAILS_ENV'] = original_rails_env
+ ENV['RAILS_ENV'] = rails
+ end
+
+ def with_rack_env(env)
+ rack = ENV['RACK_ENV']
+ ENV['RACK_ENV'] = env
+ with_rails_env(nil) { yield }
+ ensure
+ ENV['RACK_ENV'] = rack
end
end