Sha256: 239dd6454a5f0fe899b2c85a0842c5c12b89ea07235870a7e6e380fb73ccd062

Contents?: true

Size: 1.06 KB

Versions: 9

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true
module Cucumber
  module Core
    module Report
      class Summary
        attr_reader :test_cases, :test_steps

        def initialize(event_bus)
          @previous_test_case = nil
          @test_cases = Test::Result::Summary.new
          @test_steps = Test::Result::Summary.new
          subscribe_to(event_bus)
        end

        def ok?(be_strict = Test::Result::StrictConfiguration.new)
          test_cases.ok?(be_strict)
        end

        private

        def subscribe_to(event_bus)
          event_bus.on(:test_case_finished) do |event|
            if event.test_case != @previous_test_case
              @previous_test_case = event.test_case
              event.result.describe_to test_cases
            elsif event.result.passed?
              test_cases.flaky
              test_cases.decrement_failed
            end
          end
          event_bus.on(:test_step_finished) do |event|
            event.result.describe_to test_steps unless event.test_step.hook?
          end
          self
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cucumber-core-9.0.0 lib/cucumber/core/report/summary.rb
cucumber-core-8.0.1 lib/cucumber/core/report/summary.rb
cucumber-core-7.1.0 lib/cucumber/core/report/summary.rb
cucumber-core-7.0.0 lib/cucumber/core/report/summary.rb
cucumber-core-6.0.0 lib/cucumber/core/report/summary.rb
cucumber-core-5.0.2 lib/cucumber/core/report/summary.rb
cucumber-core-5.0.1 lib/cucumber/core/report/summary.rb
cucumber-core-5.0.0 lib/cucumber/core/report/summary.rb
cucumber-core-4.0.0 lib/cucumber/core/report/summary.rb