Sha256: c61d92c25ea4564cb0856b2cb68f13c815f6bddb1c01daff445099e2cba54bc3

Contents?: true

Size: 797 Bytes

Versions: 6

Compression:

Stored size: 797 Bytes

Contents

require 'spec_helper'

describe DataMapper::Property::Class do
  before :all do
    Object.send(:remove_const, :Foo) if defined?(Foo)
    Object.send(:remove_const, :Bar) if defined?(Bar)

    class ::Foo; end
    class ::Bar; end

    @name          = :type
    @type          = described_class
    @value         = Foo
    @other_value   = Bar
    @invalid_value = 1
  end

  it_should_behave_like 'A semipublic Property'

  describe '#typecast_to_primitive' do
    it 'returns same value if a class' do
      @property.typecast(@model).should equal(@model)
    end

    it 'returns the class if found' do
      @property.typecast(@model.name).should eql(@model)
    end

    it 'does not typecast non-class values' do
      @property.typecast('NoClass').should eql('NoClass')
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ardm-core-1.3.0 spec/semipublic/property/class_spec.rb
ardm-core-1.2.1 spec/semipublic/property/class_spec.rb
dm-core-1.2.1 spec/semipublic/property/class_spec.rb
dm-core-1.2.0 spec/semipublic/property/class_spec.rb
dm-core-1.2.0.rc2 spec/semipublic/property/class_spec.rb
dm-core-1.2.0.rc1 spec/semipublic/property/class_spec.rb