1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

The generator invokes rake with either the :env option, ENV['RAILS_ENV'], or development. So if Travis has exported RAILS_ENV=test, it'll be used instead of development, breaking these brittle expectations.

This commit is contained in:
Jeremy Kemper 2011-10-08 13:09:28 -07:00
parent 9ce03d1542
commit 4888aba15f

View file

@ -179,8 +179,9 @@ class ActionsTest < Rails::Generators::TestCase
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 @@ class ActionsTest < Rails::Generators::TestCase
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