Skip to content

Commit

Permalink
Isolate rake action tests that should be run under default env
Browse files Browse the repository at this point in the history
  • Loading branch information
guilleiguaran authored and jeremy committed Oct 8, 2011
1 parent e63c05f commit 09bb9de
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions railties/test/generators/actions_test.rb
Expand Up @@ -159,9 +159,11 @@ def test_generate_should_run_script_generate_with_argument_and_options
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
Expand All @@ -170,9 +172,11 @@ def test_rake_with_env_option_should_run_rake_command_in_env
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
Expand Down

0 comments on commit 09bb9de

Please sign in to comment.