Simplecov filter all controllers except certain ones

291 Views Asked by At

I am working on a Rails project that has some older code, but I only want to see the coverage of the controllers that I am working on. For example, the structure will be:

controllers/
  api/
  whatever1/
  whatever2/
  a_controller.rb
  b_controller.rb

I only want to see the coverage for controllers/api/. I know about the add_filter method from Simplecov, but adding each one of them would mean a lot of work.

Is there any way to maybe include a regex or some conditional to add filter for everything except the controllers/api folder?

1

There are 1 best solutions below

1
On

In your case the best way is to create a new group for the new controllers like that:

SimpleCov.start 'rails' do
  add_group "API Controllers", "app/controllers/api"
  #...
end