Sha256: 2ce225da2593cbba76b50b95b12c8a638647ba0f80ef2a09139513cfc212559a

Contents?: true

Size: 935 Bytes

Versions: 8

Compression:

Stored size: 935 Bytes

Contents

# frozen_string_literal: true

require "datadog/tracing/contrib/patcher"

require_relative "example"
require_relative "example_group"
require_relative "runner"

module Datadog
  module CI
    module Contrib
      module RSpec
        # Patcher enables patching of 'rspec' module.
        module Patcher
          include Datadog::Tracing::Contrib::Patcher

          module_function

          def target_version
            Integration.version
          end

          def patch
            if ci_queue?
              ::RSpec::Queue::Runner.include(Runner)
            end

            ::RSpec::Core::Runner.include(Runner)
            ::RSpec::Core::Example.include(Example)
            ::RSpec::Core::ExampleGroup.include(ExampleGroup)
          end

          def ci_queue?
            # ::RSpec::Queue::Runner is a ci-queue runner
            defined?(::RSpec::Queue::Runner)
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
datadog-ci-1.0.0.beta3 lib/datadog/ci/contrib/rspec/patcher.rb
datadog-ci-1.0.0.beta2 lib/datadog/ci/contrib/rspec/patcher.rb
datadog-ci-1.0.0.beta1 lib/datadog/ci/contrib/rspec/patcher.rb
datadog-ci-0.8.3 lib/datadog/ci/contrib/rspec/patcher.rb
datadog-ci-0.8.2 lib/datadog/ci/contrib/rspec/patcher.rb
datadog-ci-0.8.1 lib/datadog/ci/contrib/rspec/patcher.rb
datadog-ci-0.8.0 lib/datadog/ci/contrib/rspec/patcher.rb
datadog-ci-0.7.0 lib/datadog/ci/contrib/rspec/patcher.rb