What Happens
lib/fbe/sec.rb:27:
s = Integer(s.first.to_s, 10)
Integer() rejects any string containing a decimal point. If the fact's seconds (or a custom prop) property is a Float, which is exactly what Time.now - start_time produces in plain Ruby, this raises ArgumentError: invalid value for Integer(): "7200.5" instead of formatting the duration.
All four existing tests in test/fbe/test_sec.rb only use Integer literals, so this gap is untested.
Verified:
cd ~/zerocrasy/fbe && nix-shell ~/zerocrasy/shell.nix --run \
"BUNDLE_GEMFILE=~/zerocrasy/fbe/Gemfile bundle exec ruby -I lib repro_sec_float.rb"
Output: ERROR: ArgumentError: invalid value for Integer(): "7200.5"
What Should Happen
Fbe.sec should accept a Float seconds value without crashing, coercing through Float first, the same pattern already used elsewhere in this codebase (for example pmp.rb's Integer(Float(result).truncate)), e.g. Integer(Float(s.first).round).
What Happens
lib/fbe/sec.rb:27:Integer()rejects any string containing a decimal point. If the fact'sseconds(or a customprop) property is a Float, which is exactly whatTime.now - start_timeproduces in plain Ruby, this raisesArgumentError: invalid value for Integer(): "7200.5"instead of formatting the duration.All four existing tests in
test/fbe/test_sec.rbonly use Integer literals, so this gap is untested.Verified:
Output:
ERROR: ArgumentError: invalid value for Integer(): "7200.5"What Should Happen
Fbe.secshould accept a Floatsecondsvalue without crashing, coercing throughFloatfirst, the same pattern already used elsewhere in this codebase (for examplepmp.rb'sInteger(Float(result).truncate)), e.g.Integer(Float(s.first).round).