Class: SixthSense::Runners::RSpecCoverageProbe

Inherits:
Object
  • Object
show all
Defined in:
lib/sixth_sense/runners/rspec_coverage_probe.rb

Class Method Summary collapse

Class Method Details

.run(spec_path, line) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/sixth_sense/runners/rspec_coverage_probe.rb', line 11

def run(spec_path, line)
  require "rspec/core"
  require "rspec/expectations"

  Coverage.start(lines: true, branches: true)
  status = RSpec::Core::Runner.run(["--options", File::NULL, "#{spec_path}:#{line}"], StringIO.new, StringIO.new)
  result = Coverage.result
  write_snapshot(result)
  exit(status)
rescue LoadError => error
  warn error.message
  exit(127)
end