diff options
author | José Valim <jose.valim@gmail.com> | 2011-06-29 10:01:13 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-06-29 10:01:13 -0700 |
commit | c49d1f2b265173fee7ed90211baa164d79f39fb1 (patch) | |
tree | 20209681881dc23718da675f3ead74372ae41747 /railties | |
parent | d677097eb6d49f75ef41dae2ee832d5e0a1d177d (diff) | |
parent | db87e48b5e7908585a82bdd09e0947be19a4abd6 (diff) | |
download | rails-c49d1f2b265173fee7ed90211baa164d79f39fb1.tar.gz rails-c49d1f2b265173fee7ed90211baa164d79f39fb1.tar.bz2 rails-c49d1f2b265173fee7ed90211baa164d79f39fb1.zip |
Merge pull request #1899 from ihower/patch_rake_test
Make "rake test" display not only task name but also exception message.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/test_unit/testing.rake | 8 | ||||
-rw-r--r-- | railties/test/application/rake_test.rb | 26 |
2 files changed, 32 insertions, 2 deletions
diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake index 28dc40379b..b9877a83b5 100644 --- a/railties/lib/rails/test_unit/testing.rake +++ b/railties/lib/rails/test_unit/testing.rake @@ -79,10 +79,14 @@ task :test do Rake::Task[task].invoke nil rescue => e - task + { :task => task, :exception => e } end end.compact - abort "Errors running #{errors * ', '}!" if errors.any? + + if errors.any? + puts errors.map { |e| "Errors running #{e[:task]}! #{e[:exception].inspect}" }.join("\n") + abort + end end namespace :test do diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index 44ac6615de..b61e2851bf 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -59,6 +59,32 @@ module ApplicationTests Dir.chdir(app_path){ `rake stats` } end + def test_rake_test_error_output + Dir.chdir(app_path){ `rake db:migrate` } + + app_file "config/database.yml", <<-RUBY + development: + RUBY + + app_file "test/unit/one_unit_test.rb", <<-RUBY + RUBY + + app_file "test/functional/one_functional_test.rb", <<-RUBY + raise RuntimeError + RUBY + + app_file "test/integration/one_integration_test.rb", <<-RUBY + raise RuntimeError + RUBY + + silence_stderr do + output = Dir.chdir(app_path){ `rake test` } + assert_match /Errors running test:units! #<ActiveRecord::AdapterNotSpecified/, output + assert_match /Errors running test:functionals! #<RuntimeError/, output + assert_match /Errors running test:integration! #<RuntimeError/, output + end + end + def test_rake_routes_output_strips_anchors_from_http_verbs app_file "config/routes.rb", <<-RUBY AppTemplate::Application.routes.draw do |