Class: Minitest::FailureReporter::Reporter
- Inherits:
-
Object
- Object
- Minitest::FailureReporter::Reporter
- Defined in:
- lib/minitest/failure_reporter_reporter.rb
Instance Method Summary collapse
- #format(test) ⇒ Object
-
#initialize(io, options) ⇒ Reporter
constructor
A new instance of Reporter.
- #passed? ⇒ Boolean
- #record(result) ⇒ Object
- #report ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(io, options) ⇒ Reporter
Returns a new instance of Reporter.
7 8 9 10 11 |
# File 'lib/minitest/failure_reporter_reporter.rb', line 7 def initialize(io, ) @io = io @results = [] @options = end |
Instance Method Details
#format(test) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/minitest/failure_reporter_reporter.rb', line 30 def format(test) test_file, test_line = test.source_location { test_file_path: normalize_file_path(test_file), test_line: test_line, test_id: "#{test.klass}##{test.name}", test_name: test.name, test_suite: test.klass, error_class: test.failure.exception.class.name, error_message: (test), output: (test), } end |
#passed? ⇒ Boolean
13 14 15 |
# File 'lib/minitest/failure_reporter_reporter.rb', line 13 def passed? true end |
#record(result) ⇒ Object
19 20 21 22 23 |
# File 'lib/minitest/failure_reporter_reporter.rb', line 19 def record(result) if has_failures?(result) @results << result end end |
#report ⇒ Object
25 26 27 28 |
# File 'lib/minitest/failure_reporter_reporter.rb', line 25 def report failures = @results.map { |test| format(test) }.to_json @io.puts(failures) end |
#start ⇒ Object
17 |
# File 'lib/minitest/failure_reporter_reporter.rb', line 17 def start; end |