Skip to content
Browse files

The generator invokes rake with either the :env option, ENV['RAILS_EN…

…V'], or development. So if Travis has exported RAILS_ENV=test, it'll be used instead of development, breaking these brittle expectations.
  • Loading branch information...
1 parent 5d18346 commit e0513757ead5fd6d6826acc3541f410237ecd3bf @jeremy jeremy committed Oct 8, 2011
Showing with 5 additions and 3 deletions.
  1. +5 −3 railties/test/generators/actions_test.rb
View
8 railties/test/generators/actions_test.rb
@@ -158,8 +158,9 @@ def test_generate_should_run_script_generate_with_argument_and_options
action :generate, 'model', 'MyModel'
end
- def test_rake_should_run_rake_command_with_development_env
- generator.expects(:run).once.with('rake log:clear RAILS_ENV=development', :verbose => false)
+ 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)
action :rake, 'log:clear'
end
@@ -169,7 +170,8 @@ 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
- generator.expects(:run).once.with('sudo rake log:clear RAILS_ENV=development', :verbose => false)
+ expected_env = ENV['RAILS_ENV'] || 'development'
+ generator.expects(:run).once.with("sudo rake log:clear RAILS_ENV=#{expected_env}", :verbose => false)
action :rake, 'log:clear', :sudo => true
end

0 comments on commit e051375

Please sign in to comment.
Something went wrong with that request. Please try again.