Sha256: 4443d561657a4f14b2d543ad78635c56e77bde749c88a5f1ab73587ad5ad0eb4

Contents?: true

Size: 1 KB

Versions: 8

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

module Datadog
  module CI
    module Contrib
      module Cucumber
        class Filter < ::Cucumber::Core::Filter.new(:configuration)
          def test_case(test_case)
            test_retries_component.reset_retries! unless test_case_seen[test_case]
            test_case_seen[test_case] = true

            configuration.on_event(:test_case_finished) do |event|
              next unless retry_required?(test_case, event)

              test_case.describe_to(receiver)
            end

            super
          end

          private

          def retry_required?(test_case, event)
            return false unless event.test_case == test_case

            test_retries_component.should_retry?
          end

          def test_case_seen
            @test_case_seen ||= Hash.new { |h, k| h[k] = false }
          end

          def test_retries_component
            @test_retries_component ||= Datadog.send(:components).test_retries
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
datadog-ci-1.11.0 lib/datadog/ci/contrib/cucumber/filter.rb
datadog-ci-1.10.0 lib/datadog/ci/contrib/cucumber/filter.rb
datadog-ci-1.9.0 lib/datadog/ci/contrib/cucumber/filter.rb
datadog-ci-1.8.1 lib/datadog/ci/contrib/cucumber/filter.rb
datadog-ci-1.8.0 lib/datadog/ci/contrib/cucumber/filter.rb
datadog-ci-1.7.0 lib/datadog/ci/contrib/cucumber/filter.rb
datadog-ci-1.6.0 lib/datadog/ci/contrib/cucumber/filter.rb
datadog-ci-1.5.0 lib/datadog/ci/contrib/cucumber/filter.rb