Module: Datadog::CI::Contrib::RSpec::Patcher
- Includes:
- Tracing::Contrib::Patcher
- Defined in:
- lib/datadog/ci/contrib/rspec/patcher.rb
Overview
Patcher enables patching of ‘rspec’ module.
Class Method Summary collapse
Class Method Details
.ci_queue? ⇒ Boolean
44 45 46 |
# File 'lib/datadog/ci/contrib/rspec/patcher.rb', line 44 def ci_queue? !!defined?(::RSpec::Queue::Runner) end |
.knapsack_pro? ⇒ Boolean
48 49 50 51 52 53 54 |
# File 'lib/datadog/ci/contrib/rspec/patcher.rb', line 48 def knapsack_pro? knapsack_version = Gem.loaded_specs["knapsack_pro"]&.version # additional instrumentation is needed for KnapsackPro version 7 and later !!defined?(::KnapsackPro) && !knapsack_version.nil? && knapsack_version >= Gem::Version.new("7") end |
.patch ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/datadog/ci/contrib/rspec/patcher.rb', line 23 def patch # ci-queue test runner instrumentation # https://github.com/Shopify/ci-queue if ci_queue? ::RSpec::Queue::Runner.include(Runner) end if knapsack_pro? # Knapsack Pro test runner instrumentation # https://github.com/KnapsackPro/knapsack_pro-ruby require_relative "knapsack_pro/patcher" Datadog::CI::Contrib::RSpec::KnapsackPro::Patcher.patch end # default rspec test runner instrumentation ::RSpec::Core::Runner.include(Runner) ::RSpec::Core::Example.include(Example) ::RSpec::Core::ExampleGroup.include(ExampleGroup) end |
.target_version ⇒ Object
19 20 21 |
# File 'lib/datadog/ci/contrib/rspec/patcher.rb', line 19 def target_version Integration.version end |