diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2011-10-08 16:27:22 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2011-10-08 16:44:40 -0500 |
commit | f655895e87c8e013caac649986510eff4d3b03d9 (patch) | |
tree | 569d03affe49d82f340bad8b90a35dcfaa58566e /railties/test | |
parent | 2274c9212ebfb04920861902d32d5f0e487bd2b6 (diff) | |
download | rails-f655895e87c8e013caac649986510eff4d3b03d9.tar.gz rails-f655895e87c8e013caac649986510eff4d3b03d9.tar.bz2 rails-f655895e87c8e013caac649986510eff4d3b03d9.zip |
Isolate rake action tests that should be run under default env
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/actions_test.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index d5301dcdb2..51fa2fe16f 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -180,9 +180,11 @@ class ActionsTest < Rails::Generators::TestCase end def test_rake_should_run_rake_command_with_default_env - expected_env = ENV['RAILS_ENV'] || 'development' - generator.expects(:run).once.with("rake log:clear RAILS_ENV=#{expected_env}", :verbose => false) + generator.expects(:run).once.with("rake log:clear RAILS_ENV=development", :verbose => false) + old_env, ENV['RAILS_ENV'] = ENV["RAILS_ENV"], nil action :rake, 'log:clear' + ensure + ENV["RAILS_ENV"] = old_env end def test_rake_with_env_option_should_run_rake_command_in_env @@ -207,9 +209,11 @@ class ActionsTest < Rails::Generators::TestCase end def test_rake_with_sudo_option_should_run_rake_command_with_sudo - expected_env = ENV['RAILS_ENV'] || 'development' - generator.expects(:run).once.with("sudo rake log:clear RAILS_ENV=#{expected_env}", :verbose => false) + generator.expects(:run).once.with("sudo rake log:clear RAILS_ENV=development", :verbose => false) + old_env, ENV['RAILS_ENV'] = ENV["RAILS_ENV"], nil action :rake, 'log:clear', :sudo => true + ensure + ENV["RAILS_ENV"] = old_env end def test_capify_should_run_the_capify_command |