I am trying to use SimpleCov to gather code coverage information but I can't seem to understand how it works. It always give me 0.0% LOC. Do I need to do something to make it work?
require 'simplecov'
SimpleCov.start
SimpleCov.command_name 'Unit Tests'
def foo
puts '12345'
end
foo
I see the following output:
$ ruby mytest.rb
12345
Coverage report generated for Unit Tests to /private/tmp/simpletest/coverage. 0.0 / 0.0 LOC (100.0%) covered.
Do I have to use it under rspec or some special environment? Can I not just enable code coverage for arbitrary code?