Sha256: 45b7b022d5006b3f476e2bd32843e20181fba9f3668b281ce9499c6346774f38

Contents?: true

Size: 1.08 KB

Versions: 15

Compression:

Stored size: 1.08 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? || event.result.skipped?
              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

15 entries across 15 versions & 4 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/cucumber-core-12.0.0/lib/cucumber/core/report/summary.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/cucumber-core-11.1.0/lib/cucumber/core/report/summary.rb
cucumber-core-12.0.0 lib/cucumber/core/report/summary.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/report/summary.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/report/summary.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/report/summary.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/report/summary.rb
cucumber-core-11.1.0 lib/cucumber/core/report/summary.rb
cucumber-core-11.0.0 lib/cucumber/core/report/summary.rb
cucumber-core-10.1.1 lib/cucumber/core/report/summary.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-core-10.1.0/lib/cucumber/core/report/summary.rb
cucumber-core-10.1.0 lib/cucumber/core/report/summary.rb
cucumber-core-10.0.1 lib/cucumber/core/report/summary.rb
cucumber-core-10.0.0 lib/cucumber/core/report/summary.rb
cucumber-core-9.0.1 lib/cucumber/core/report/summary.rb