I’m having trouble finding a simple example on how to use simplecov with rake/rspec.
Here’s the repo I have setup: https://github.com/stensonb/simplecov-playground
If you clone this, and “bundle install”, “rake coverage”, you’ll see 0/0 LOC…which is disappointing.
As the project sits now (8e5fa35983), I expect there to be 0/XX LOC (where XX is the actual lines of code I have…clearly more than zero – look at /lib/mytest.rb)
Things I’ve tried:
- adding “require ‘simplecov'” and “SimpleCov.start” to my spec_helper.rb
- adding groups to the simplecov config
Anybody have a suggestion on how to get this thing to work?
Solved!
The major item I was missing was “requiring” my lib file in my test.
I had assumed simplecov would pull in ALL of my files by looking at the directory structure…but that doesn’t appear to happen. It will only asses the codes explicitly loaded into the classpath (to use java parlance)…using “requires”, or “load”, or “include”, I assume.
I’ll push my solution back to this github location later today.