Formatters helper `format_duration` incorrectly formats time when using `mathn`
Created by: greggroth
If mathn
is required, then format_duration
will report the minutes as a fraction rather than casting to an integer (consequently, the seconds calculation is also wrong). For example:
expected: "1 minute 10.14 seconds"
got: "7/6 minutes 0.14 seconds"
The challenge is testing this with and without mathn
loaded. I think it's a bad idea to just require it in the formatters since that will could cause failures in test suites that aren't expecting to have mathn
loaded. However, it would be better if the times could be well-formatted for applications that do use mathn
. The solution is simple, but I'm having a difficult time writing a test for this that doesn't leave mathn
hanging around to affect other tests. Are there any ideas on how a test can be written for this?