Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-covered code shown as covered. #365

Closed
AlexCppns opened this issue Jan 28, 2015 · 4 comments
Closed

non-covered code shown as covered. #365

AlexCppns opened this issue Jan 28, 2015 · 4 comments

Comments

@AlexCppns
Copy link

There is a block of code in our application that was not tested but still highlighted in green. Is there a way to see where this come from?

@bf4
Copy link
Collaborator

bf4 commented Jan 28, 2015

I can't duplicate without example, but please see #340

SimpleCov doesn't record tested code. It records executed code. So, assuming simplecov starts before any app code is loaded or run, it will record any code executed simply by requiring/loading the file, and any tests that execute that code.

The best you could do, and this is just regular ruby, is

def method_i_am_not_testing
  puts "And yet I am being called by #{caller[0]}"
end

@bf4 bf4 closed this as completed Jan 28, 2015
@bf4
Copy link
Collaborator

bf4 commented Jan 28, 2015

Please re-open with any new info if you believe I closed this in error.

@AlexCppns
Copy link
Author

Alright, I found what was doing it. It was called indirectly by another method which I am using in a test I didn't finish writing yet.

What bugs me is that testing the bigger methods implies testing some of the smaller ones. In practice, I like to test each method individually.

@bf4
Copy link
Collaborator

bf4 commented Jan 29, 2015

Well, the real problem is that we are using newly executed code for tested code. That's just the nature of the beast, for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants