Sha256: 3c5f7e09c3f93f371cf2594f669f97b634637e292886952b0cde451abb613ba1

Contents?: true

Size: 545 Bytes

Versions: 4

Compression:

Stored size: 545 Bytes

Contents

require 'spec_helper'

describe Hari::Entity::Serialization::Date do

  describe '.serialize' do
    it 'converts to date string' do
      subject.serialize(Date.new(2011, 07, 01)).should == '2011-07-01'
    end
  end

  describe '.desserialize' do
    it 'converts to date' do
      subject.desserialize('2011-07-01').should == Date.new(2011, 07, 01)
    end

    context 'when an invalid value is desserialized' do
      it 'raises an error' do
        expect { subject.desserialize('not a date') }.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/date_spec.rb
hari-0.0.4 spec/hari/entity/serialization/date_spec.rb
hari-0.0.3 spec/hari/entity/serialization/date_spec.rb
hari-0.0.1 spec/hari/entity/serialization/date_spec.rb