Shopify / measured-rails

Rails adapter for the measured gem. Encapsulate measurements and their units in Ruby and Rails.
MIT License
92 stars 13 forks source link

Do not error if unit is already known to be invalid #21

Closed kmcphillips closed 8 years ago

kmcphillips commented 8 years ago

@cyprusad @garethson @RichardBlair @mdking

Found the bug. Follow up to #20.

If the unit is already known to be invalid, but there is a validation that includes a numericality check we try to instantiate the measurement to do comparisons. But then that would raise.

So just skip the numericality checks if the unit is already known to be invalid. Can't do anything about it anyway.

garethson commented 8 years ago

Good find. Maybe assert_nothing_raised? Which I never actually got the point of.

garethson commented 8 years ago

:ship:

kmcphillips commented 8 years ago

I don't like assert_nothing_raised because the test fails if it raises anyway.

mdking commented 8 years ago

:+1: