5

I would like to ensure that all new lines written added are covered by test. Is there a simple way to do an intersection between git diff and simplecov coverage.

http://fredwu.me/post/35625566267/simplecov-test-coverage-for-changed-files-only something like this but with lines granularity instead of files

user229044
  • 232,980
  • 40
  • 330
  • 338
trax
  • 739
  • 8
  • 21
  • HoundCI runs rubocop on your commits. It's just rubocop, but anyway you can check their code (it's open source) and get hints. – rewritten Dec 04 '14 at 18:51

1 Answers1

3

For git diffs, there is a tool named diff-cover, which can check coverage. It takes Cobertura XML coverage reports and compares with the output of git diff. It then reports coverage information for lines in the diff.

With an xml file produced by simplecov-cobertura, you can use this command to check the coverage of your changes compared to the master branch:

$ diff-cover coverage.xml
Dag Høidahl
  • 7,873
  • 8
  • 53
  • 66