diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-05 09:19:32 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-05 09:19:32 -0800 |
commit | ddd4fac8cc1dc3cbffdd4ef71fd260b601a17695 (patch) | |
tree | 07955176072c0881e71dfc782fbb3d730560a262 /railties/test/application/runner_test.rb | |
parent | 396c0681acab95a58f0583d722f488b5b01398d8 (diff) | |
parent | a7695579a5979245f7d5e683a67bbfc096f3099a (diff) | |
download | rails-ddd4fac8cc1dc3cbffdd4ef71fd260b601a17695.tar.gz rails-ddd4fac8cc1dc3cbffdd4ef71fd260b601a17695.tar.bz2 rails-ddd4fac8cc1dc3cbffdd4ef71fd260b601a17695.zip |
Merge pull request #8427 from kennyj/support_rack_env
Add ENV['RACK_ENV'] support to rake runner/console/server.
Diffstat (limited to 'railties/test/application/runner_test.rb')
-rw-r--r-- | railties/test/application/runner_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/railties/test/application/runner_test.rb b/railties/test/application/runner_test.rb index 81ed5873a5..797c7a9470 100644 --- a/railties/test/application/runner_test.rb +++ b/railties/test/application/runner_test.rb @@ -67,5 +67,28 @@ module ApplicationTests assert_match "true", Dir.chdir(app_path) { `bundle exec rails runner "puts Rails.application.config.ran"` } end + + def test_default_environment + assert_match "development", Dir.chdir(app_path) { `bundle exec rails runner "puts Rails.env"` } + end + + def test_environment_with_rails_env + orig = ENV['RAILS_ENV'] + ENV['RAILS_ENV'] = "production" + assert_match "production", Dir.chdir(app_path) { `bundle exec rails runner "puts Rails.env"` } + ensure + ENV['RAILS_ENV'] = orig + end + + def test_environment_with_rails_env + rack, rails = ENV['RACK_ENV'], ENV['RAILS_ENV'] + ENV['RACK_ENV'] = "production" + ENV['RAILS_ENV'] = nil + assert_match "production", Dir.chdir(app_path) { `bundle exec rails runner "puts Rails.env"` } + ensure + ENV['RAILS_ENV'] = rails + ENV['RACK_ENV'] = rack + end + end end |