This repository has been archived by the owner on Nov 30, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 760
Formatters helper format_duration
incorrectly formats time when using mathn
#1086
Comments
iamvery
added a commit
to iamvery/rspec-core
that referenced
this issue
Sep 27, 2013
* As @greggroth pointed out in rspec#1086, the formatter does not work as expected when the mathn lib is loaded. This lib adds the Rational type which is formatted as "n/n" when stringified rather than the float form. By explicitly converting the arithmetic to the types we wish to stringify, this display is corrected. [rspec#1086]
Fixed by #1087. |
myronmarston
pushed a commit
that referenced
this issue
Sep 28, 2013
* As @greggroth pointed out in #1086, the formatter does not work as expected when the mathn lib is loaded. This lib adds the Rational type which is formatted as "n/n" when stringified rather than the float form. By explicitly converting the arithmetic to the types we wish to stringify, this display is corrected. * This contains all commits of PR #1087, squashed together for easy back-porting to 2-14-maintenance and 2-99-maintenance.
myronmarston
pushed a commit
that referenced
this issue
Sep 28, 2013
* As @greggroth pointed out in #1086, the formatter does not work as expected when the mathn lib is loaded. This lib adds the Rational type which is formatted as "n/n" when stringified rather than the float form. By explicitly converting the arithmetic to the types we wish to stringify, this display is corrected. * This contains all commits of PR #1087, squashed together for easy back-porting to 2-14-maintenance and 2-99-maintenance.
yujinakayama
pushed a commit
to yujinakayama/rspec-monorepo
that referenced
this issue
Oct 6, 2021
* As @greggroth pointed out in rspec/rspec-core#1086, the formatter does not work as expected when the mathn lib is loaded. This lib adds the Rational type which is formatted as "n/n" when stringified rather than the float form. By explicitly converting the arithmetic to the types we wish to stringify, this display is corrected. * This contains all commits of PR rspec/rspec-core#1087, squashed together for easy back-porting to 2-14-maintenance and 2-99-maintenance. --- This commit was imported from rspec/rspec-core@0f99d62.
yujinakayama
pushed a commit
to yujinakayama/rspec-monorepo
that referenced
this issue
Oct 6, 2021
* As @greggroth pointed out in rspec/rspec-core#1086, the formatter does not work as expected when the mathn lib is loaded. This lib adds the Rational type which is formatted as "n/n" when stringified rather than the float form. By explicitly converting the arithmetic to the types we wish to stringify, this display is corrected. * This contains all commits of PR rspec/rspec-core#1087, squashed together for easy back-porting to 2-14-maintenance and 2-99-maintenance. --- This commit was imported from rspec/rspec-core@490ec33.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
If
mathn
is required, thenformat_duration
will report the minutes as a fraction rather than casting to an integer (consequently, the seconds calculation is also wrong). For example: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 havemathn
loaded. However, it would be better if the times could be well-formatted for applications that do usemathn
. The solution is simple, but I'm having a difficult time writing a test for this that doesn't leavemathn
hanging around to affect other tests. Are there any ideas on how a test can be written for this?The text was updated successfully, but these errors were encountered: