Show the right file when test raises

This commit is contained in:
Arthur Neves 2015-01-23 22:57:52 -05:00 committed by Yves Senn
parent a71bcdb4f3
commit ccee7eea8e
2 changed files with 4 additions and 4 deletions

@ -14,10 +14,9 @@ def aggregated_results # :nodoc:
filtered_results = results.dup filtered_results = results.dup
filtered_results.reject!(&:skipped?) unless options[:verbose] filtered_results.reject!(&:skipped?) unless options[:verbose]
filtered_results.map do |result| filtered_results.map do |result|
result.failures.map { |failure| location, line = result.method(result.name).source_location
"bin/rails test #{failure.location}\n" "bin/rails test #{location}:#{line}"
}.join "\n" end.join "\n"
end.join
end end
end end
end end

@ -65,6 +65,7 @@ def test_failure
output = run_test_file('unit/failing_test.rb', env: { "BACKTRACE" => "1" }) output = run_test_file('unit/failing_test.rb', env: { "BACKTRACE" => "1" })
assert_match %r{/app/test/unit/failing_test\.rb}, output assert_match %r{/app/test/unit/failing_test\.rb}, output
assert_match %r{/app/test/unit/failing_test\.rb:4}, output
end end
test "ruby schema migrations" do test "ruby schema migrations" do