aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/time
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2021-03-27 13:02:41 +0100
committerBenoit Daloze <eregontp@gmail.com>2021-03-27 13:02:41 +0100
commit95d9fe9538441eb57ee6752aa1c5088fc6608e34 (patch)
tree9a0bb070fd8042b83470f7a0bf9cd462c919c7c0 /spec/ruby/core/time
parent44736a6b7a2b3475db2d05187f33e3c1a7b4b4e5 (diff)
downloadruby-95d9fe9538441eb57ee6752aa1c5088fc6608e34.tar.gz
Update to ruby/spec@fd6eddd
Diffstat (limited to 'spec/ruby/core/time')
-rw-r--r--spec/ruby/core/time/at_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/core/time/at_spec.rb b/spec/ruby/core/time/at_spec.rb
index 4ff38bbd21..ff43537dcc 100644
--- a/spec/ruby/core/time/at_spec.rb
+++ b/spec/ruby/core/time/at_spec.rb
@@ -38,6 +38,20 @@ describe "Time.at" do
Time.at(BigDecimal('1.1')).to_f.should == 1.1
end
end
+
+ describe "passed Rational" do
+ it "returns Time with correct microseconds" do
+ t = Time.at(Rational(1_486_570_508_539_759, 1_000_000))
+ t.usec.should == 539_759
+ t.nsec.should == 539_759_000
+ end
+
+ it "returns Time with correct nanoseconds" do
+ t = Time.at(Rational(1_486_570_508_539_759_123, 1_000_000_000))
+ t.usec.should == 539_759
+ t.nsec.should == 539_759_123
+ end
+ end
end
describe "passed Time" do