Sha256: cba7bb4ae133834e8d4cdb229672093df118724056feaeb2662a266bdb9da29b

Contents?: true

Size: 576 Bytes

Versions: 3

Compression:

Stored size: 576 Bytes

Contents

require "petitest/texts/base_text"

module Petitest
  module Texts
    class FailureMessageText < ::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
        colorize(
          [
            test_case.failure_assertion_type_message,
            test_case.failure_additional_message,
          ].compact.join("\n"),
          :failure,
        )
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
petitest-0.1.3 lib/petitest/texts/failure_message_text.rb
petitest-0.1.2 lib/petitest/texts/failure_message_text.rb
petitest-0.1.1 lib/petitest/texts/failure_message_text.rb