Sha256: 7b616c206df58723d1c35ce0d0b07840f85ffd1ba6dac38e9441642daf4022e0

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require "petitest/subscribers/base_subscriber"
require "petitest/subscriber_concerns/output_concern"
require "petitest/subscriber_concerns/time_concern"

module Petitest
  module Subscribers
    class DocumentReportSubscriber < ::Petitest::Subscribers::BaseSubscriber
      include ::Petitest::SubscriberConcerns::OutputConcern
      include ::Petitest::SubscriberConcerns::TimeConcern

      # @note Override
      def after_running_test_case(test_case)
        super
        string = ::Petitest::Texts::TestCaseResultLineText.new(test_case: test_case).to_s
        output.puts(string)
      end

      # @note Override
      def after_running_test_cases(test_cases)
        super
        string = ::Petitest::Texts::TestCasesResultText.new(
          finished_at: finished_at,
          started_at: started_at,
          test_cases: test_cases,
        ).to_s
        output.puts(string)
      end

      # @note Override
      def before_running_test_group(test_group_class)
        super
        string = "#{'  ' * test_group_class.nest_level}#{test_group_class.description}"
        output.puts(string)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
petitest-0.2.1 lib/petitest/subscribers/document_report_subscriber.rb