Skip to content

Instantly share code, notes, and snippets.

View jessevanherk's full-sized avatar

Jesse van Herk jessevanherk

View GitHub Profile
@mislav
mislav / test_helper.rb
Last active May 20, 2020 14:52
Vim highlight lines of Ruby that are not covered with tests. When the test suite runs, SimpleCov will generate a "coverage/raw" file. Next, the Vim function can be used to read data from that file for the current buffer and mark lines not covered with tests.
require 'simplecov'
require 'coveralls'
# writes out a "coverage/raw" file to be read by Vim
class RawMissingLinesFormatter
def format(result)
File.open('coverage/raw', 'w') { |raw|
result.source_files.each do |file|
file.lines.each do |line|
if line.missed?