[BUG] Rails spec failing based on local currency
Closed this issue · 4 comments
When running rails spec in systems that uses another default currency (different from "$"), tests that compare money values happens to fail.
Description
After setting up the project correctly, when i run the ./bin/rails spec
command, some tests fail, this is clearly due to localization issues (in my case i live in Brazil, and brazilian currency is R$). I don't know if it's some postgres configuration or some computer based configuration. I think the tests should consider any possible currency to run correctly.
Expected Behavior
- The tests should pass independently of the system currency
Actual Behavior
- Tests that compares money are failing
Possible Fix
I don't know if it's a good a ideia, but a possible fix for this issue could be comparing only the value of the money instead of the whole string.
Steps to Reproduce
Obs.: The tests only fail in systems that are not configured to use American Dollar as default currency
- Set up the project
- Run
./bin/rails spec
Context
This bug happened in the first time I was setting up the project, when the tests failed, my first thought was that something about my set up was wrong and i shoul re-do it. This bug may cause confusion in new contributors to the project from other places in the world.
Your Environment
- Ruby version: 2.7.6
- Operating System and version: Pop! _OS 20.04
@murilogds thanks for reporting this! Is it only those four tests that fail?
@murilogds thanks for reporting this! Is it only those four tests that fail?
Yes, only the ones in the image!
@murilogds it's definitely related to the Postgres config. That said, the currency symbol added should be based on the currency of the nonprofit.
Is this something you'd be open to trying to fix?
@wwahammy For sure, I'll take this issue with @Giuulob89.