Class: Minitest::Reporters::FailureFormatter

Inherits:
SimpleDelegator
  • Object
show all
Includes:
ANSI::Code
Defined in:
lib/minitest/reporters/failure_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(test) ⇒ FailureFormatter

Returns a new instance of FailureFormatter.



9
10
11
12
# File 'lib/minitest/reporters/failure_formatter.rb', line 9

def initialize(test)
  @test = test
  super
end

Instance Method Details

#to_h ⇒ Object



22
23
24
25
26
27
28
# File 'lib/minitest/reporters/failure_formatter.rb', line 22

def to_h
  {
    test_and_module_name: "#{test.class}##{test.name}",
    test_name: test.name,
    output: to_s,
  }
end

#to_s ⇒ Object



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

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