Class: Maxitest::Line::LineReporter
- Inherits:
-
Minitest::Reporter
- Object
- Minitest::Reporter
- Maxitest::Line::LineReporter
- Defined in:
- lib/maxitest/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.
37 38 39 40 |
# File 'lib/maxitest/line.rb', line 37 def initialize(*) super @failures = [] end |
Instance Method Details
#record(result) ⇒ Object
42 43 44 45 46 |
# File 'lib/maxitest/line.rb', line 42 def record(result) if !result.skipped? && !result.passed? @failures << result end end |
#report ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/maxitest/line.rb', line 48 def report return unless @failures.any? io.puts io.puts "Focus on failing tests:" pwd = Pathname.new(Dir.pwd) bin_rails = File.exist?("bin/rails") @failures.each do |res| result = (res.respond_to?(:source_location) ? res : res.method(res.name)) file, line = result.source_location next unless file file = Pathname.new(file) file = file.relative_path_from(pwd) if file.absolute? output = "#{bin_rails ? "bin/rails test" : "minitest"} #{file}:#{line}" output = "\e[31m#{output}\e[0m" if $stdout.tty? io.puts output end end |