Sha256: a664787f53fa74fa0850175608a2b629f72a57e4c497a69f7e6713489bcf307b

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

try_spec do

  require './spec/fixtures/person'

  describe Ardm::Fixtures::Person do
    before do
      @resource = Ardm::Fixtures::Person.new(:name => '')
    end

    describe 'with a birthday' do
      before do
        @resource.birthday = '1983-05-03'
      end

      describe 'after typecasting string input' do
        it 'has a valid birthday' do
          expect(@resource.birthday).to eq(::Time.parse('1983-05-03'))
        end
      end

      describe 'when dumped and loaded again' do
        before do
          expect(@resource.save).to be true
          @resource.reload
        end

        it 'has a valid birthday' do
          expect(@resource.birthday).to eq(::Time.parse('1983-05-03'))
        end
      end
    end

    describe 'without a birthday' do
      before do
        @resource.birthday = nil
      end

      describe 'after typecasting nil' do
        it 'has a nil value for birthday' do
          expect(@resource.birthday).to be_nil
        end
      end

      describe 'when dumped and loaded again' do
        before do
          expect(@resource.save).to be true
          @resource.reload
        end

        it 'has a nil value for birthday' do
          expect(@resource.birthday).to be_nil
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ardm-0.1.0 spec/integration/epoch_time_spec.rb