Evaluating More Coverage in Ruby 3.2 - Kevin Murphy

19-Jan-2023 1034
As I mentioned in my prior post, Ruby 3.2.0 has some changes to the Coverage module. Now the module can measure the coverage of a Ruby expression in a string passed to the eval method.This is important because of templates. ERB, when we ask for the template through the result method, calls eval. When Rails is rendering a view, that also calls eval. More specifically, Rails calls the module_eval method.Have you wondered how much of the logic in your views is exercised in your test suite? Thanks to this change, now you can see that in tools like SimpleCov.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle