Class: Minitest::LineReporter
- Inherits:
-
Reporter
- Object
- Reporter
- Minitest::LineReporter
- Defined in:
- lib/maxitest/vendor/line.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.
99 100 101 102 |
# File 'lib/maxitest/vendor/line.rb', line 99 def initialize(*) super @failures = [] end |
Instance Method Details
#record(result) ⇒ Object
104 105 106 107 108 |
# File 'lib/maxitest/vendor/line.rb', line 104 def record(result) if !result.skipped? && !result.passed? @failures << result end end |
#report ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/maxitest/vendor/line.rb', line 110 def report return unless @failures.any? io.puts io.puts "Focus on failing tests:" pwd = Pathname.new(Dir.pwd) @failures.each do |res| meth = res.method(res.name) file, line = meth.source_location if file file = Pathname.new(file) file = file.relative_path_from(pwd) if file.absolute? output = "mtest #{file}:#{line}" output = "\e[31m#{output}\e[0m" if $stdout.tty? io.puts output end end end |