I am a huge fan of testing and when I run my current coverage reports I noticed that my lib sub folders with .rb files are not being picked up by simplecov.
Here is my setup in my spec_helper.rb file:
if ENV['COVERAGE']
require 'simplecov'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter
]
SimpleCov.minimum_coverage 90
SimpleCov.start do
coverage_dir 'tmp/coverage'
add_filter '/.bundle/'
add_filter '/spec/'
add_filter '/config/'
add_group 'Models', 'app/models'
add_group 'Controllers', 'app/controllers'
add_group 'Services', 'app/services'
add_group 'Helpers', 'app/helpers'
add_group 'Lib', 'lib'
add_group 'Mailers', 'app/mailers'
add_group "Long Files" do |src_file|
src_file.lines.count > 100
end
add_group 'Ignored Code' do |src_file|
open(src_file.filename).grep(/:nocov:/).any?
end
end
end
While I do not have much in that folder today, I am trying to figure out why they are not coming in. Currently, I would have expected to see my lib/modules
folder in my reports b/c it has a helper_functions.rb file used by rake inside.
Also, I have tried these solutions with no luck: