Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add test to rake test for error messages

  • Loading branch information...
commit db87e48b5e7908585a82bdd09e0947be19a4abd6 1 parent 89ad062
@ihower ihower authored
View
6 railties/lib/rails/test_unit/testing.rake
@@ -82,7 +82,11 @@ task :test do
{ :task => task, :exception => e }
end
end.compact
- abort errors.map { |e| "Errors running #{e[:task]}! #{e[:exception].inspect}" }.join("\n") 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
View
26 railties/test/application/rake_test.rb
@@ -59,6 +59,32 @@ def test_code_statistics_sanity
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
Please sign in to comment.
Something went wrong with that request. Please try again.