Module: Datadog::CI::Contrib::RSpec::KnapsackPro::Patcher

Defined in:
lib/datadog/ci/contrib/rspec/knapsack_pro/patcher.rb

Class Method Summary collapse

Class Method Details

.patchObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/datadog/ci/contrib/rspec/knapsack_pro/patcher.rb', line 9

def self.patch
  if defined?(::KnapsackPro::Extensions::RSpecExtension::Runner) &&
      ::RSpec::Core::Runner.ancestors.include?(::KnapsackPro::Extensions::RSpecExtension::Runner)
    # knapsack already patched rspec runner
    require_relative "runner"
    ::RSpec::Core::Runner.include(KnapsackPro::Runner)
  else
    # knapsack didn't patch rspec runner yet
    require_relative "extension"
    ::KnapsackPro::Extensions::RSpecExtension.include(KnapsackPro::Extension)
  end
end