diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2011-10-08 13:09:28 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2011-10-08 13:09:28 -0700 |
commit | 4888aba15f98b630d624645f7bba5a53bfdabb2f (patch) | |
tree | c701a76a384162ec1603762731294f3be7f40385 /railties/test/generators | |
parent | 9ce03d15428fee6f63e72a3de7b60f5e1ab8a97a (diff) | |
download | rails-4888aba15f98b630d624645f7bba5a53bfdabb2f.tar.gz rails-4888aba15f98b630d624645f7bba5a53bfdabb2f.tar.bz2 rails-4888aba15f98b630d624645f7bba5a53bfdabb2f.zip |
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.
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/actions_test.rb | 8 |
1 files changed, 5 insertions, 3 deletions
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 |