The purpose of branch coverage is to check whether every conditional branch in a given line of code has been tested and Ruby has this feature since 2.5. Ruby’s simplecov can report branch coverage too and now so does undercover with the new 0.4 release!

This addition allows you to detect even more untested code within each automated pull request review, including untested case statements, conditional method calls (e.g. foo&.jump), single-line ifs (return :foo if valid?) or ternaries (foo ? 1 : 2).

Head over to the readme if you’re getting started, otherwise here’s what to do to add branch…

Jan Grodowski

software engineer @rainforestqa, hardware hacker and fixed-gear cycling enthusiast from Warsaw, PL.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store