提交 db87e48b 编写于 作者: W Wen-Tien Chang

Add test to rake test for error messages

上级 89ad0629
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册