Sha256: a0aadb7d357760a3b30fa72802d92f6676fc782690f427db1df879b1a8d852b9

Contents?: true

Size: 620 Bytes

Versions: 4

Compression:

Stored size: 620 Bytes

Contents

require 'spec_helper'

describe Hari::Entity::Serialization::DateTime do

  describe '.serialize' do
    it 'converts to date time string' do
      subject.serialize(DateTime.new(2011, 07, 01, 10, 20, 30)).should == '2011-07-01T10:20:30+00:00'
    end
  end

  describe '.desserialize' do
    it 'converts to date time' do
      subject.desserialize('2011-07-01T10:20:30').should == DateTime.new(2011, 07, 01, 10, 20, 30)
    end

    context 'when an invalid value is desserialized' do
      it 'raises an error' do
        expect { subject.desserialize('not a date time') }.to raise_error
      end
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hari-0.0.5 spec/hari/entity/serialization/datetime_spec.rb
hari-0.0.4 spec/hari/entity/serialization/datetime_spec.rb
hari-0.0.3 spec/hari/entity/serialization/datetime_spec.rb
hari-0.0.1 spec/hari/entity/serialization/datetime_spec.rb