ruby-on-railsminitestsimplecov

Why doesn't SimpleCov recognize my module tests?


I have a module in app/helpers that I've written tests for in test/helpers, but after running SimpleCov, it's showing 0% coverage for my helper.

I'm using MiniTest to run my tests and SimpleCov looks to be accurately reporting the test coverage for my other files. For my module, I have:

module MyHelper
  def some_method
    ...
  end
end

For my test file, I have:

class MyHelperTest < ActiveSupport::TestCase
  describe 'when extending a class' do
    it 'should work' do
      assert some_method
    end
  end
end

Any idea why SimpleCov might not be recognizing my tests?


Solution

  • Setting config.cache_classes = false in environments/test.rb fixed my reporting issue.