I’m trying to understand why using load vs require results in different
I’m writing a gem with dynamically loaded code that was previously not
detected by SimpleCov. I was able to partially fix this by rewriting the
code such that I can use Kernel::load instead of Object#instance_eval.
The remaining problem was that instance method definitions in my code
were reported by SimpleCov as not executed even though I clearly did.
Here’s a sample (Notice how #url and #headers are red):
Here’s the test for the above code:
Kernel.load(path, true) and Kernel.load(path, false) yielded the same
results. Then I realized that, with the recent changes I made, I can
also actually use require. When I did that, here are the updated
coverage report for that file: aviator/aviator | Job 1 | lib/aviator/openstack/compute/v2/public/list_images.rb | Coveralls - Test Coverage History & Statistics. So
the problem was solved as far as I was concerned.
My question is why the difference in the report when using load instead
P.S. Additional discussion on the original problem may be found in this