-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
simplecov not covering lib directory in Rails engine -- NOT a missing require #221
Comments
We discovered we needed to use the HEAD version of the gem AND do this in the spec_helper:
|
Although this does work, it feels a little hackie. I'll try to get some time to make a pull request to get simplecov to detect this and load. Thanks for the workaround! |
Actually, loading the files above didn't work for me correctly as it's order,directory dependent => flaky. Instead I did the following and it worked nicely: https://gist.github.com/bsodmike/5866873 SimpleCov.start('rails') do |
@lsaffie Thanks I'll try that next time I work on an engine. |
Great this got fixed by the recent release, thanks for reporting back! @lsaffie That's a cool idea, I'll add this to the README documentation. |
@lsaffie, how can I use add_filter and add_group to coverage several engines in different group. |
@hongweikang check out these examples: https://gist.github.com/bsodmike/5866873 |
@lsaffie , thank you, that's work well.But the simplecov just coverage code that spec code include.How to Above is the engine that doesn't call by spec code.But our goal is to detect every engine's code coverage rate. |
👍 @hongweikang I have the same problem as you do. |
Please create a new issue (or submit a PR) on how to have SimpleCov report coverage for files outside of For reference, the config example in at @lsaffie's link is adapters.delete(:root_filter)
filters.clear
add_filter do |src|
!(src.filename =~ /^#{SimpleCov.root}/) unless src.filename =~ /\/my_engine\//
end |
In my rails engine simplecov does not (or rather will not) provide coverage for the lib directory.
I tried adding the root directory of the engine to the loadpath in spec_helper, and doing
require "lib/myengine"
, which did not work.HOWEVER If I simply rename
lib
tobob
and change the corresponding require in the spec torequire 'bob/myclass'
, the coverage DOES get created.The issue seems to be purely with the name
lib
. 🐤Adding a group with the lib path does not help the matter.
The text was updated successfully, but these errors were encountered: