File: datetime_spec.rb

package info (click to toggle)
libextlib-ruby 0.9.13-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 532 kB
  • ctags: 487
  • sloc: ruby: 7,120; makefile: 3
file content (22 lines) | stat: -rw-r--r-- 516 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
require 'json'

describe DateTime, "#to_time" do
  before do
    @expected = Time.now.to_s
    @datetime = DateTime.parse(@expected)
  end

  it "should return a copy of time" do
    time = @datetime.to_time
    time.class.should == Time
    time.to_s.should == @expected
  end
end

describe Time, "#to_datetime" do
  it "should return a copy of its self" do
    datetime = DateTime.now
    datetime.to_datetime.should == datetime
  end
end