You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pr #515 introduced a change to the equality comparison where two money instances of different currencies will be equal if their amount is zero.
This is problematic as it breaks expectations, for example if you are explicitly expecting to receive 0 USD, but the you received 0 EUR, the code will silently work if you are using built in equality. This applies to both expectations and matchers used in mocking.
This case was hard to debug in our application and we fix it with a custom especially matcher that does a strict equality check.
I’d even argue that the motivating issue in money-rails stems from the lax use of auto converting integers to money instances where the default was unexpected.
The text was updated successfully, but these errors were encountered:
Pr #515 introduced a change to the equality comparison where two money instances of different currencies will be equal if their amount is zero.
This is problematic as it breaks expectations, for example if you are explicitly expecting to receive 0 USD, but the you received 0 EUR, the code will silently work if you are using built in equality. This applies to both expectations and matchers used in mocking.
This case was hard to debug in our application and we fix it with a custom especially matcher that does a strict equality check.
I’d even argue that the motivating issue in money-rails stems from the lax use of auto converting integers to money instances where the default was unexpected.
The text was updated successfully, but these errors were encountered: