Simplecov: devise model 0% coverage

Created on 17 Jul 2017  路  4Comments  路  Source: simplecov-ruby/simplecov

Running minitest on rails 5.1.2. Spring is not enabled and simplecov start is at the very beginning of application_system_test_case.rb:

image

image

Code is tested using unit and integration tests, so this code is definitely running

Most helpful comment

Yey now is working! Great tip on printing outputs as things gets loaded. I ended up using config/initializers/simplecov.rb as this:

image

Thank you

All 4 comments

:wave:

You say it is at the beginning of "application_system_test_case.rb" - I'm not very familiar with the new rails system tests, but OAuth code usually is hard to E2E test. So I guess it's done in Unit tests and unit tests shouldn't require your system case unit case, so simplecov also (or even firstly) needs to be started in the test_helper that you call for your minitest tests.

Moved it to test_helper.rb

image

Same results:

image

Looks a bit like the class is loaded before simplecov is started. Otherwise at least the class definition should be covered.

What test command do you run?

Could you add a puts "Simplecov" after simplecov was started and a puts "User loaded" at the top of your user class file or inside the user class, I'd bet the one in the user class appears so simplecov isn't started first :)

Yey now is working! Great tip on printing outputs as things gets loaded. I ended up using config/initializers/simplecov.rb as this:

image

Thank you

Was this page helpful?
0 / 5 - 0 ratings