Sha256: 1d0d491652e714137efa95a041e9d4fe9b2bd3443b75b6b08088b7d2fbbd6357

Contents?: true

Size: 880 Bytes

Versions: 3

Compression:

Stored size: 880 Bytes

Contents

require File.expand_path('../spec_helper', File.dirname(__FILE__))
require 'gorillib/datetime/flat'
require 'gorillib/datetime/parse'

describe Time do
  describe '#to_flat' do
    before do
      @time_utc  = Time.parse("2011-02-03T04:05:06 UTC")
      @time_cst  = Time.parse("2011-02-02T22:05:06-06:00")
      @time_flat = "20110203040506"
    end

    it 'converts times to UTC' do
      @time_utc.to_flat.should == @time_flat
      @time_cst.to_flat.should == @time_flat
    end

    it 'round-trips' do
      Time.parse_safely(@time_flat).to_flat.should == @time_flat
      Time.parse_safely(@time_utc.to_flat).should  == @time_utc
    end

  end
end

describe Date do
  describe '#to_flat' do
    before do
      @date      = Date.new(2011, 2, 3)
      @date_flat = "20110203"
    end

    it 'converts dates' do
      @date.to_flat.should == @date_flat
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gorillib-0.1.11 spec/datetime/flat_spec.rb
gorillib-0.1.9 spec/datetime/flat_spec.rb
gorillib-0.1.8 spec/datetime/flat_spec.rb