Sha256: 3badab9e67d8e221f0e496f9f12605a6ffb4682d911c460ddeb41e1f881b97c7

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 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(test)
        super
        string = ::Petitest::Texts::TestResultLineText.new(test: test).to_s
        output.puts(string)
      end

      # @note Override
      def after_running_test_plan(test_plan)
        super
        string = ::Petitest::Texts::TestsResultText.new(
          finished_at: finished_at,
          started_at: started_at,
          tests: test_plan.tests,
        ).to_s
        output.puts(string)
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
petitest-0.3.1 lib/petitest/subscribers/document_report_subscriber.rb
petitest-0.3.0 lib/petitest/subscribers/document_report_subscriber.rb