Sha256: 6a84bb20e14f44525bff7391cba6719b5c8783f636844137cb86f140f2da2c40

Contents?: true

Size: 1.41 KB

Versions: 7

Compression:

Stored size: 1.41 KB

Contents

require 'spec_helper'

try_spec do

  require './spec/fixtures/person'

  describe DataMapper::TypesFixtures::Person do
    supported_by :all do
      before :all do
        @resource = DataMapper::TypesFixtures::Person.new(:name => '')
      end

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

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

        describe 'when dumped and loaded again' do
          before :all do
            @resource.save.should be(true)
            @resource.reload
          end

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

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

        describe 'after typecasting nil' do
          it 'has a nil value for birthday' do
            @resource.birthday.should be_nil
          end
        end

        describe 'when dumped and loaded again' do
          before :all do
            @resource.save.should be(true)
            @resource.reload
          end

          it 'has a nil value for birthday' do
            @resource.birthday.should be_nil
          end
        end
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
ardm-types-1.2.3 spec/integration/epoch_time_spec.rb
ardm-types-1.2.2 spec/integration/epoch_time_spec.rb
dm-types-1.2.2 spec/integration/epoch_time_spec.rb
dm-types-1.2.1 spec/integration/epoch_time_spec.rb
dm-types-1.2.0 spec/integration/epoch_time_spec.rb
dm-types-1.2.0.rc2 spec/integration/epoch_time_spec.rb
dm-types-1.2.0.rc1 spec/integration/epoch_time_spec.rb