github / scientist

:microscope: A Ruby library for carefully refactoring critical paths.
MIT License
7.47k stars 442 forks source link

Support error comparison #77

Closed cdwort closed 3 years ago

cdwort commented 6 years ago

This is currently a breaking change!!

Fixes #50.

This PR changes the interface of equivalent_to? to support only two procs (compare and error_compare). While this is the interface that I would write now, I imagine you'll want to keep backwards compatibility.

What's your preferred means of doing that? Change the equivalent_to? method to be:

def equivalent_to(other, error_comparator=nil, &comparator)

If that looks good to y'all, I'll update this PR to use ^^ interface.

Thanks!!

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.5%) to 98.598% when pulling 62c3fb99c52c97f723a150ee260eabb29b44e027 on cdwort:support_error_comparison into 25be7a23ffb583adaf9a0bf9b03754b114f0be11 on github:master.

cdwort commented 6 years ago

Lol, :'( I see the coveralls comment... and I can't seem to find the way to see where the coverage failed... although seems likely that the setup method error_compare is what I'm lacking.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.009%) to 99.065% when pulling 1f9a48782a71bc8f92eaecb2690da1c8075c53a1 on cdwort:support_error_comparison into 25be7a23ffb583adaf9a0bf9b03754b114f0be11 on github:master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.009%) to 99.065% when pulling 1f9a48782a71bc8f92eaecb2690da1c8075c53a1 on cdwort:support_error_comparison into 25be7a23ffb583adaf9a0bf9b03754b114f0be11 on github:master.

joeltaylor commented 5 years ago

@cdwort are you still planning on wrapping this one up? If not, I'm happy to jump in to help out.

izuzak commented 3 years ago

:wave: @zerowidth @cdwort Hello from the future! 😸2️⃣0️⃣2️⃣1️⃣

I agree this would be a neat feature to have in Scientist, so I updated this PR based on the review comments from 2018. @cdwort I hope you do mind me pushing directly to your branch to make these updates 😅

Could I trouble you to re-review this PR and see if there's anything else we want to do? 🙏

Two notes:

Thanks! :bow: