Class: Minitest::Sprint::SprintReporter
- Inherits:
-
AbstractReporter
- Object
- AbstractReporter
- Minitest::Sprint::SprintReporter
- Defined in:
- lib/minitest/sprint.rb
Overview
An extra minitest reporter to output how to rerun failures in various styles.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#results ⇒ Object
:nodoc:.
-
#style ⇒ Object
The style to report, either lines or regexp.
Instance Method Summary collapse
-
#initialize(style = :regexp) ⇒ SprintReporter
constructor
:nodoc:.
-
#print_list ⇒ Object
:nodoc:.
-
#record(result) ⇒ Object
:nodoc:.
-
#report ⇒ Object
:nodoc:.
Methods inherited from AbstractReporter
#passed?, #prerecord, #start, #synchronize
Constructor Details
#initialize(style = :regexp) ⇒ SprintReporter
:nodoc:
41 42 43 44 |
# File 'lib/minitest/sprint.rb', line 41 def initialize style = :regexp # :nodoc: self.results = [] self.style = style end |
Instance Attribute Details
#results ⇒ Object
:nodoc:
39 40 41 |
# File 'lib/minitest/sprint.rb', line 39 def results @results end |
#style ⇒ Object
The style to report, either lines or regexp. Defaults to lines.
38 39 40 |
# File 'lib/minitest/sprint.rb', line 38 def style @style end |
Instance Method Details
#print_list ⇒ Object
:nodoc:
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/minitest/sprint.rb', line 60 def print_list # :nodoc: case style when :regexp results.each do |result| puts " minitest -n #{result.class_name}##{result.name}" end when :lines files = Hash.new { |h,k| h[k] = [] } results.each do |result| path, line = result.source_location path = path.delete_prefix "#{Dir.pwd}/" files[path] << line end files.sort.each do |path, lines| puts " minitest %s:%s" % [path, lines.sort.join(",")] end else raise "unsupported style: %p" % [style] end end |
#record(result) ⇒ Object
:nodoc:
46 47 48 |
# File 'lib/minitest/sprint.rb', line 46 def record result # :nodoc: results << result unless result.passed? or result.skipped? end |
#report ⇒ Object
:nodoc:
50 51 52 53 54 55 56 57 58 |
# File 'lib/minitest/sprint.rb', line 50 def report # :nodoc: return if results.empty? puts puts "Happy Happy Sprint List:" puts print_list puts end |