Sha256: 2ccd28b14db8f768bf0f08aec42826baed60a071dbaeb48a8758421bc3550a50

Contents?: true

Size: 1.28 KB

Versions: 13

Compression:

Stored size: 1.28 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_truthy
          @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_truthy
          @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

13 entries across 13 versions & 1 rubygems

Version Path
ardm-0.4.0.ar427 spec/integration/epoch_time_spec.rb
ardm-0.4.0 spec/integration/epoch_time_spec.rb
ardm-0.3.2 spec/integration/epoch_time_spec.rb
ardm-0.3.1 spec/integration/epoch_time_spec.rb
ardm-0.3.0 spec/integration/epoch_time_spec.rb
ardm-0.2.7 spec/integration/epoch_time_spec.rb
ardm-0.2.6 spec/integration/epoch_time_spec.rb
ardm-0.2.5 spec/integration/epoch_time_spec.rb
ardm-0.2.4 spec/integration/epoch_time_spec.rb
ardm-0.2.3 spec/integration/epoch_time_spec.rb
ardm-0.2.2 spec/integration/epoch_time_spec.rb
ardm-0.2.1 spec/integration/epoch_time_spec.rb
ardm-0.2.0 spec/integration/epoch_time_spec.rb