Sha256: 80254422ba9740fefe5a9ae59658f4a346f80936ca59c06ac12ca06ad8ae2dbd

Contents?: true

Size: 582 Bytes

Versions: 4

Compression:

Stored size: 582 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'
require 'json'

describe Time, "#to_json" do

  before do
    @expected = "\"2008-03-28T22:54:20Z\""
  end

  it "should transform itself into a ISO 8601 compatible string" do
    Time.utc(2008, 3, 28, 22, 54, 20).to_json.should == @expected
    Time.xmlschema("2008-03-28T22:54:20Z").to_json.should == @expected
    Time.xmlschema("2008-03-28T17:54:20-05:00").to_json.should == @expected
  end
end

describe Time, "#to_time" do
  it "should return a copy of its self" do
    time = Time.now
    time.to_time.should == time
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
extlib-0.9.12 spec/time_spec.rb
extlib-0.9.10 spec/time_spec.rb
extlib-0.9.11 spec/time_spec.rb
extlib-0.9.9 spec/time_spec.rb