Reputation: 539
i use minitest framework for testing and simplecov gem for code coverage. i have a problem about simplecov. my problem is lkie this:
i wrote a model test. when i run the test using rake minitest:models, test runs and coverage shows %100. But when i run tests using bundle exec rake, the code coverage of same tests are shown missing.
i make researching on net. some people also have problem like this about simplecov. but i could not find a solution for this. i'm waiting your ideas. Thanks in advance.
Upvotes: 1
Views: 1665
Reputation: 23344
Did you enabled simplecov
by doing SimpleCov.start
on top of your code?
This is required as the first statement i.e. before your code, otherwise you will never get it work.
Also include the SimpleCoV Adapter.
As following the post generating-code-coverage-metrics-for-a-ruby-on-rails-project-with-simplecov, define rules with SimpleCov putting conditions:
SimpleCov.start do
# rules here
end if ENV["COVERAGE"]
Then run the coverage on demand by specifying the coverage variable:
COVERAGE=true bundle exec rake spec
Upvotes: 2