diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2018-01-03 08:00:27 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2018-01-03 17:37:14 +0900 |
commit | ff0d5f14504f1aa29ad908ab15bab66b101427b7 (patch) | |
tree | d3a6320e57cdb709f6b9977a32324949508263e5 /railties/lib/rails/test_unit | |
parent | 3a077f369199651fa62a3e9b8ab2d8f8ee70a0e9 (diff) | |
download | rails-ff0d5f14504f1aa29ad908ab15bab66b101427b7.tar.gz rails-ff0d5f14504f1aa29ad908ab15bab66b101427b7.tar.bz2 rails-ff0d5f14504f1aa29ad908ab15bab66b101427b7.zip |
Correctly get source location
`filtered_results` returns an instance of `Minitest::Result` since https://github.com/seattlerb/minitest/commit/00433fc0a4fdd0e6b302aace633384ba13122376
`Minitest::Result` is not test class. So cannot get location directly.
Diffstat (limited to 'railties/lib/rails/test_unit')
-rw-r--r-- | railties/lib/rails/test_unit/reporter.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/railties/lib/rails/test_unit/reporter.rb b/railties/lib/rails/test_unit/reporter.rb index 7d3164f1eb..c8b7b70611 100644 --- a/railties/lib/rails/test_unit/reporter.rb +++ b/railties/lib/rails/test_unit/reporter.rb @@ -68,7 +68,12 @@ module Rails end def format_rerun_snippet(result) - location, line = result.method(result.name).source_location + location, line = if result.respond_to?(:source_location) + result.source_location + else + result.method(result.name).source_location + end + "#{executable} #{relative_path_for(location)}:#{line}" end |