Sha256: b19faf4b28dccc7fef4091e9fa6f6e468ad0e53001afa062a4e13e9d30f736f0

Contents?: true

Size: 663 Bytes

Versions: 1

Compression:

Stored size: 663 Bytes

Contents

require "petitest/texts/base_text"

module Petitest
  module Texts
    class ErrorMessageText < ::Petitest::Texts::BaseText
      # @return [Petitest::TestCase]
      attr_reader :test_case

      # @param test_case [Petitest::TestCase]
      def initialize(test_case:)
        @test_case = test_case
      end

      # @note Override
      def to_s
        elements = []
        elements << test_case.error_class_name unless test_case.error.is_a?(::Petitest::AssertionFailureError)
        elements << test_case.error_message unless test_case.error_message.empty?
        string = elements.join("\n")
        colorize(string, :error)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
petitest-0.2.1 lib/petitest/texts/error_message_text.rb