When you hear the word Ruby, what is the first thing that comes to your mind? Some of its advantages? Or the list of projects that were developed using Ruby? For us, Ruby is the language of choice, so we can’t be indifferent when we’ve got something new to tell you. Undercover is a new Ruby gem for code coverage that we eager to show you in this article.
Undercover inspects files in and warns on methods, classes, and blocks that we need to test coverage.
That’s what you need to do first:
- Add this line to your application’s Gemfile:
- Then execute:
- Or install it as:
$ gem install undercover
To make your specs or tests compatible with
undercover by providing an LCOV report, please add
simplecov-lcov to your test setup.
The aim was to create a tool to help others ensure that tests are written for all the recent code changes. This works for any ruby project, but especially big codebases that lack testing.
The goal was to provide automated warnings, that are:
- relevant, so scoped to the actual code changes
- timely, so we don’t write tests long after the implementation
- actionable, so we can fix them before the code is committed
For more background, please here.
P.S.Take the advantage of another interesting tool – StringScanner Ruby gem provides lexical scanning operations on a string. Do you want to find even out more? Don’t hesitate to check our latest Rails digest with the most interesting and promising Ruby gems!