Sha256: c93179c959cfa0c642184af4ebd43b9dca27b250f0ae165108d6f63ac3897a5f

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

require "petitest/texts/base_text"

module Petitest
  module Texts
    class TestCasesResultText < ::Petitest::Texts::BaseText
      # @return [Time]
      attr_reader :finished_at

      # @return [Time]
      attr_reader :started_at

      # @return [Array<Petitest::TestCase>]
      attr_reader :test_cases

      # @param finished_at [Time]
      # @param started_at [Time]
      # @param test_cases [Array<Petitest::TestCase>]
      def initialize(
        finished_at:,
        started_at:,
        test_cases:
      )
        @finished_at = finished_at
        @started_at = started_at
        @test_cases = test_cases
      end

      # @note Override
      def to_s
        [
          ::Petitest::Texts::TestCasesResultMarginTopText.new(test_cases: test_cases),
          [
            ::Petitest::Texts::FailuresText.new(test_cases: test_cases.select(&:failed?)),
            ::Petitest::Texts::ErrorsText.new(test_cases: test_cases.select(&:aborted?)),
            ::Petitest::Texts::TestCountsText.new(test_cases: test_cases),
            ::Petitest::Texts::TimesText.new(
              finished_at: finished_at,
              started_at: started_at,
            ),
          ].join("\n\n"),
        ].join
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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