Class: Minitest::LineReporter
- Inherits:
-
Reporter
- Object
- Reporter
- Minitest::LineReporter
- Defined in:
- lib/minitest/line_plugin.rb
Instance Method Summary collapse
-
#initialize ⇒ LineReporter
constructor
A new instance of LineReporter.
- #record(result) ⇒ Object
- #report ⇒ Object
Constructor Details
#initialize ⇒ LineReporter
Returns a new instance of LineReporter.
61 62 63 64 |
# File 'lib/minitest/line_plugin.rb', line 61 def initialize(*) super @failures = [] end |
Instance Method Details
#record(result) ⇒ Object
66 67 68 69 70 |
# File 'lib/minitest/line_plugin.rb', line 66 def record(result) if !result.skipped? && !result.passed? @failures << result end end |
#report ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/minitest/line_plugin.rb', line 72 def report return unless @failures.any? io.puts io.puts "Focus on failing tests:" pwd = Pathname.new(Dir.pwd) @failures.each do |res| result = (res.respond_to?(:source_location) ? res : res.method(res.name)) file, line = result.source_location if file file = Pathname.new(file) file = file.relative_path_from(pwd) if file.absolute? output = "ruby #{file} -l #{line}" output = "\e[31m#{output}\e[0m" if $stdout.tty? io.puts output end end end |