In development run your tests with the DISABLE_SPRING=1 flag before the test command and see if you see a difference in coverage.
On Sun, Oct 21, 2018 at 12:17 AM Jason Hsu, Ruby on High Speed Rails < jhsu802...@gmail.com> wrote: > How can I get test coverage results to show more consistent results that > make sense? > > I earlier decided against having SimpleCov and test coverage badges in my > Rails apps. It seemed that no matter how I configured SimpleCov, there > were some glaring flaws in its results. However, I have since changed my > mind as a result of working on a legacy Rails app that had very sparse test > coverage when I first joined. SimpleCov showed only 25% test coverage. As > a result, I've decided to make test coverage a standard part of all Rails > apps I'm on. Test coverage metrics may have their flaws, but I figure that > test coverage results should flag the parts of the test suite that need the > most improvement. > > So I've added test coverage to my new Ruby.MN app. The production site is > at http://rubymn2.herokuapp.com/, and the source code is at > https://github.com/jhsu802701/rubymn2 . Currently, the CodeCov badge > shows 93% test coverage, and the results make sense to me. > > However, SimpleCov in my local development environment shows test coverage > of only 76%. In fact, it doesn't recognize ANY of my user or admin model > tests. CodeCov does, and this is why it shows a much better test coverage > figure. > > What's going on? Why is there such a big discrepancy? How can I > configure SimpleCov to show results that make more sense? > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/e6a363bb-0bc0-4c81-94a1-0b58d8ac3fec%40googlegroups.com > <https://groups.google.com/d/msgid/rubyonrails-talk/e6a363bb-0bc0-4c81-94a1-0b58d8ac3fec%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAJ6MPz%2B4jVwow%3D1LoCkevRo5%3Dn4r%2B-tYdZDTcCLYENW9aN5iEg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.