class Minitest::Hyper::Reporter::HashFormatter
Public Class Methods
as_hash(reporter)
click to toggle source
# File lib/minitest/hyper/reporter.rb, line 30 def self.as_hash(reporter) self.new(reporter).to_h end
new(reporter)
click to toggle source
# File lib/minitest/hyper/reporter.rb, line 34 def initialize(reporter) @reporter = reporter end
Public Instance Methods
reporter()
click to toggle source
# File lib/minitest/hyper/reporter.rb, line 38 def reporter @reporter end
result_class(result)
click to toggle source
# File lib/minitest/hyper/reporter.rb, line 86 def result_class(result) result_code(result).to_s end
result_code(result)
click to toggle source
# File lib/minitest/hyper/reporter.rb, line 73 def result_code(result) case result.failure when Skip :skip when UnexpectedError :error when Assertion :fail else :pass end end
result_data(results)
click to toggle source
# File lib/minitest/hyper/reporter.rb, line 56 def result_data(results) collection = [] results.each do |result| collection << { name: result.name, code: result_code(result), class: result_class(result), outcome: result_string(result), time: result.time, assertions: result.assertions, location: result.location, failure: result.failure } end collection end
result_string(result)
click to toggle source
# File lib/minitest/hyper/reporter.rb, line 90 def result_string(result) result_code(result).to_s.capitalize end
to_h()
click to toggle source
# File lib/minitest/hyper/reporter.rb, line 42 def to_h { count: reporter.count, assertions: reporter.assertions, start_time: reporter.start_time, total_time: reporter.total_time, failures: reporter.failures, errors: reporter.errors, skips: reporter.skips, results: result_data(reporter.all_results), non_passing: result_data(reporter.results) } end