class Petitest::Texts::ErrorMessageText

Attributes

test[R]

@return [Petitest::Test]

Public Class Methods

new(test:) click to toggle source

@param test [Petitest::Test]

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

Public Instance Methods

to_s() click to toggle source

@note Override

# File lib/petitest/texts/error_message_text.rb, line 15
def to_s
  elements = []
  elements << test.runner.error_class_name unless test.runner.error.is_a?(::Petitest::AssertionFailureError)
  elements << test.runner.error_message unless test.runner.error_message.empty?
  string = elements.join("\n")
  colorize(string, :error)
end