0

I have a simple Ruby app with the following structure

root
|___ app
      |___ a.rb
      |___ b.rb
      |___ z.rb
|___ spec
      |___ app
            |___ a_spec.rb
            |___ b_spec.rb
            |___ z_spec.rb
      |___ tasks
            |___ atask_spec.rb
      |___ spec_helper.rb
|____ tasks
      |___ atask.rake

I'd like to check code coverage using simplecov so I have added the gem to my Gemfile and the following code to my spec helper

require 'simplecov'
SimpleCov.start do
  add_filter '/spec/'
end

But, when I run all my specs (bin/rspec spec) SimpleCov considers only the code in tasks/atask.rake.

I have also checked SimpleCov.root and it returns correctly the root. Am I missing anything here?

Thanks

Sig
  • 5,476
  • 10
  • 49
  • 89
  • Do you include simplecov gem to your Gemfile with `require: false`? Do you `require 'simplecove'` _at the very top_ of your spec_helper.rb? – DNNX Jun 27 '17 at 08:40
  • Yes to both questions (see spec helper above). As mentioned the coverage runs and gives me the result. The problem is that is not considering the app folder. – Sig Jun 27 '17 at 11:06
  • possible duplicate of the https://stackoverflow.com/questions/29561242/simplecov-report-ignores-folders-in-app-directory – Oshan Wisumperuma Jan 20 '19 at 15:39

0 Answers0