diff options
author | Dmitriy Kiriyenko <dmitriy.kiriyenko@anahoret.com> | 2011-09-29 15:35:25 +0300 |
---|---|---|
committer | Dmitriy Kiriyenko <dmitriy.kiriyenko@anahoret.com> | 2011-09-29 15:35:25 +0300 |
commit | 148e4a541361f140f13aa35bb43b3d57c95831d6 (patch) | |
tree | 77a9670f6fa552e0eeea1a9c783c6e992bc8c1ae /railties/test/generators | |
parent | 64b0c8888b908ede5372e0a70cb4cb8731d372ba (diff) | |
download | rails-148e4a541361f140f13aa35bb43b3d57c95831d6.tar.gz rails-148e4a541361f140f13aa35bb43b3d57c95831d6.tar.bz2 rails-148e4a541361f140f13aa35bb43b3d57c95831d6.zip |
Honour RAILS_ENV environment variable when running rake.
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/actions_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index 94e9abb3cc..e621f7f6f7 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -189,6 +189,22 @@ class ActionsTest < Rails::Generators::TestCase action :rake, 'log:clear', :env => 'production' end + def test_rake_with_rails_env_variable_should_run_rake_command_in_env + generator.expects(:run).once.with('rake log:clear RAILS_ENV=production', :verbose => false) + old_env, ENV["RAILS_ENV"] = ENV["RAILS_ENV"], "production" + action :rake, 'log:clear' + ensure + ENV["RAILS_ENV"] = old_env + end + + def test_env_option_should_win_over_rails_env_variable_when_running_rake + generator.expects(:run).once.with('rake log:clear RAILS_ENV=production', :verbose => false) + old_env, ENV["RAILS_ENV"] = ENV["RAILS_ENV"], "staging" + action :rake, 'log:clear', :env => 'production' + ensure + ENV["RAILS_ENV"] = old_env + end + def test_rake_with_sudo_option_should_run_rake_command_with_sudo generator.expects(:run).once.with('sudo rake log:clear RAILS_ENV=development', :verbose => false) action :rake, 'log:clear', :sudo => true |