Class: Minitest::Queue::FailureFormatter

Inherits:
SimpleDelegator
  • Object
show all
Includes:
CI::Queue::OutputHelpers
Defined in:
lib/minitest/queue/failure_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(test) ⇒ FailureFormatter

Returns a new instance of FailureFormatter.



10
11
12
13
# File 'lib/minitest/queue/failure_formatter.rb', line 10

def initialize(test)
  @test = test
  super
end

Instance Method Details

#to_hObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/minitest/queue/failure_formatter.rb', line 23

def to_h
  test_file, test_line = test.source_location
  {
    test_file: test_file,
    test_line: test_line,
    test_and_module_name: "#{test.klass}##{test.name}",
    test_name: test.name,
    test_suite: test.klass,
    error_class: test.failure.error.class.name,
    output: to_s,
  }
end

#to_sObject



15
16
17
18
19
20
21
# File 'lib/minitest/queue/failure_formatter.rb', line 15

def to_s
  [
    header,
    body,
    "\n"
  ].flatten.compact.join("\n")
end