aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/test_unit
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2016-02-15 14:59:03 +0100
committerYves Senn <yves.senn@gmail.com>2016-02-15 15:19:16 +0100
commitea70c295ffc7b335ed6c587f4060746e8b59d833 (patch)
tree9f75790319b11197986e5f231da92affa4c7c23a /railties/lib/rails/test_unit
parent7c3dc9632b2ae2feca90f5b1f88b9ce3ca5fbba9 (diff)
downloadrails-ea70c295ffc7b335ed6c587f4060746e8b59d833.tar.gz
rails-ea70c295ffc7b335ed6c587f4060746e8b59d833.tar.bz2
rails-ea70c295ffc7b335ed6c587f4060746e8b59d833.zip
Revert "Prefer Minitest's location for test failures."
This reverts commit 0db310586ac3e15be95d2ef27ff40cfa24c05c10. Closes #23686. Conflicts: railties/test/application/test_runner_test.rb It's possible that the `result.location` returned by minitest is outside the test file itself. For example in the case of mocha. This resulted in bad rerun snipptets: ``` bin/rails test app/models/deliveries/delivery.rb:103 ``` Let's always use the first line of the failed test-case in our rerun snippet. We can display the line number of the assertion error elsewhere.
Diffstat (limited to 'railties/lib/rails/test_unit')
-rw-r--r--railties/lib/rails/test_unit/reporter.rb10
1 files changed, 2 insertions, 8 deletions
diff --git a/railties/lib/rails/test_unit/reporter.rb b/railties/lib/rails/test_unit/reporter.rb
index 73b8d7d27b..317726f672 100644
--- a/railties/lib/rails/test_unit/reporter.rb
+++ b/railties/lib/rails/test_unit/reporter.rb
@@ -73,14 +73,8 @@ module Rails
end
def format_rerun_snippet(result)
- # Try to extract path to assertion from backtrace.
- if result.location =~ /\[(.*)\]\z/
- assertion_path = $1
- else
- assertion_path = result.method(result.name).source_location.join(':')
- end
-
- "#{self.executable} #{relative_path_for(assertion_path)}"
+ location, line = result.method(result.name).source_location
+ "#{self.executable} #{relative_path_for(location)}:#{line}"
end
def app_root