Skip to content

Commit a9d9965

Browse files
committed
Add spec for small Rational passed to Time::at
1 parent 1c3ecb1 commit a9d9965

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

spec/ruby/core/time/at_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@
3838
Time.at(BigDecimal('1.1')).to_f.should == 1.1
3939
end
4040
end
41+
42+
describe "passed Rational" do
43+
it "returns Time with correct nanosecond and microsecond" do
44+
t = Time.at(Rational(1_486_570_508_539_759, 1_000_000))
45+
t.usec.should == 539_759
46+
t.nsec.should == 539_759_000
47+
end
48+
end
4149
end
4250

4351
describe "passed Time" do

0 commit comments

Comments
 (0)