#511: Correct sign in Fbe.sec so elapsed seconds format as past#518
#511: Correct sign in Fbe.sec so elapsed seconds format as past#518VasilevNStas wants to merge 2 commits into
Conversation
kreinba
left a comment
There was a problem hiding this comment.
Sign flip from (Time.now + s).ago to (Time.now - s).ago matches the elapsed-time contract that the method name and YARD example promise, and resolves #511. New test test_elapsed_past pins the 7200-second case to '2h' using Time.stub from minitest/mock (already required in test/test__helper.rb), which is a strict guard the prior start_with?('5m') assertion was missing. Docstring is realigned to the short tago form. CI is green on every check.
|
@kreinba Great work on the review! 🎉 You've earned +6 points (base +18, -8 for missing comments, -4 for low code coverage with 18 hits). Your total score is now +1538 - keep up the momentum and check your Zerocracy account for updates! |
|
@VasilevNStas merge conflict here |
|
Please fix the merge conflicts so this pull request can be merged. |
e7bb169 to
c9b0575
Compare
…d call unreachable due to short-circuit
|
@yegor256 plz re-review |
Description
Fbe.secused(Time.now + s).ago, which for a positivesformatted a future time as "from now". The method's purpose is to format elapsed seconds (past time), so the sign was wrong.Fix
Changed line 29 from
(Time.now + s).agoto(Time.now - s).ago. Updated YARD docstring to match the actual tago gem output format (short form:"2h"instead of"2 hours ago").Closes #511
Tests
test_elapsed_past— verifies thatFbe.secreturns"2h"for a fact withseconds = 7200(would return"1h59m"with the buggy code)Verification
bundle exec rubocop— 0 offensesbundle exec rake test— 0 failures