Module: RSpec::Covers::Integration

Defined in:
lib/rspec/covers/integration.rb

Class Method Summary collapse

Class Method Details

.install!(rspec_config) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rspec/covers/integration.rb', line 16

def install!(rspec_config)
  return if RSpec::Covers.installed?

  RSpec::Covers.mark_installed!
  install_expect_hook

  rspec_config.before(:suite) do
    RSpec::Covers.coverage_probe.start
  end

  rspec_config.around(:example) do |example|
    RSpec::Covers.run_example(example)
  end

  rspec_config.after(:suite) do
    RSpec::Covers.reporter.finalize_suggestions(RSpec::Covers.configuration)
    RSpec::Covers.reporter.write_json(RSpec::Covers.configuration.report_path)
  end
end

.install_expect_hookObject



36
37
38
39
40
41
# File 'lib/rspec/covers/integration.rb', line 36

def install_expect_hook
  return unless defined?(::RSpec::Matchers)
  return if ::RSpec::Matchers.ancestors.include?(ExpectHook)

  ::RSpec::Matchers.prepend(ExpectHook)
end