summaryrefslogtreecommitdiff
path: root/spec/ruby/core/time/at_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/time/at_spec.rb')
-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