aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/time/to_r_spec.rb
blob: 6af2d9b7ea2a74a005630c9c6e02543e8d801b23 (plain)
1
2
3
4
5
6
7
8
9
10
11
require_relative '../../spec_helper'

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