aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/time/to_r_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/time/to_r_spec.rb')
-rw-r--r--spec/ruby/core/time/to_r_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/ruby/core/time/to_r_spec.rb b/spec/ruby/core/time/to_r_spec.rb
new file mode 100644
index 0000000000..53e469463a
--- /dev/null
+++ b/spec/ruby/core/time/to_r_spec.rb
@@ -0,0 +1,11 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe "Time#to_r" do
+ it "returns the a Rational representing seconds and subseconds since the epoch" do
+ Time.at(Rational(11, 10)).to_r.should eql(Rational(11, 10))
+ end
+
+ it "returns a Rational even for a whole number of seconds" do
+ Time.at(2).to_r.should eql(Rational(2))
+ end
+end