From 4888aba15f98b630d624645f7bba5a53bfdabb2f Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 8 Oct 2011 13:09:28 -0700 Subject: 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. --- railties/test/generators/actions_test.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'railties/test/generators') diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index e621f7f6f7..d5301dcdb2 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -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 -- cgit v1.2.3