class Petitest::Texts::FailuresText

Attributes

tests[R]

@return [Array<Petitest::Test>]

Public Class Methods

new(tests:) click to toggle source

@param tests [Array<Petitest::Test>]

# File lib/petitest/texts/failures_text.rb, line 10
def initialize(tests:)
  @tests = tests
end

Public Instance Methods

to_s() click to toggle source

@note Override

# File lib/petitest/texts/failures_text.rb, line 15
def to_s
  [
    heading,
    indent(body, 2),
  ].join("\n\n")
end

Private Instance Methods

body() click to toggle source

@return [String]

# File lib/petitest/texts/failures_text.rb, line 25
def body
  failures_element_texts.join("\n\n")
end
failures_element_texts() click to toggle source

@return [Array<Petitest::Textx::FailuresElementText>]

# File lib/petitest/texts/failures_text.rb, line 30
def failures_element_texts
  tests.map.with_index do |test, index|
    ::Petitest::Texts::FailuresElementText.new(
      index: index,
      test: test,
    )
  end
end
heading() click to toggle source

@return [String]

# File lib/petitest/texts/failures_text.rb, line 40
def heading
  "Failures:"
end