Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 4888aba15f98b630d624645f7bba5a53bfdabb2f 1 parent 9ce03d1
@jeremy jeremy authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 railties/test/generators/actions_test.rb
View
8 railties/test/generators/actions_test.rb
@@ -179,8 +179,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
@@ -206,7 +207,8 @@ def test_env_option_should_win_over_rails_env_variable_when_running_rake
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
Please sign in to comment.
Something went wrong with that request. Please try again.