ruby-on-railsrubysimplecov

SimpleCov not showing rails files


I'm trying to use simplecov to monitor my test coverage however after having to roll back some changes to my project and reinstall simplecov it seems to have broken.

It no longer tracks the models and controller ect, but instead covers the spec files, as can be seen here:

enter image description here

How can I get it back to how it should be where it's tracking the actual rails files in separate tabs?

Any help would be great!


Solution

  • I guess you have an initializer or something where you are configuring SimpleCov, you need to define the groups there like this:

    SimpleCov.start do
      add_group "Models", "app/models"
      add_group "Controllers", "app/controllers"
      add_group "Long files" do |src_file|
        src_file.lines.count > 100
      end
      add_group "Multiple Files", ["app/models", "app/controllers"] # You can also pass in an array
      add_group "Short files", LineFilter.new(5) # Using the LineFilter class defined in Filters section above
    end