diff options
author | kennyj <kennyj@gmail.com> | 2012-12-06 02:05:33 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2012-12-06 02:05:33 +0900 |
commit | a7695579a5979245f7d5e683a67bbfc096f3099a (patch) | |
tree | 07955176072c0881e71dfc782fbb3d730560a262 /railties/test/application | |
parent | 396c0681acab95a58f0583d722f488b5b01398d8 (diff) | |
download | rails-a7695579a5979245f7d5e683a67bbfc096f3099a.tar.gz rails-a7695579a5979245f7d5e683a67bbfc096f3099a.tar.bz2 rails-a7695579a5979245f7d5e683a67bbfc096f3099a.zip |
Add ENV['RACK_ENV'] support to rake runner/console/server.
Diffstat (limited to 'railties/test/application')
-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 |