Changeset [cd100fee5ce98e8ade231b8aa4386c70817d3ccc] by Markus Schirp

November 27th, 2011 @ 06:17 PM

Fix inconsistency in Rule::PrimitiveType

There was a discussion between me an solnic month ago. I thought we
have to test the loaded value against load_as. Solnic convinced me we
have to test against the dump_as.

But something totally different was implemented: Testing loaded value
(property.get resource), against dumped value. This was not spotted since 99% of all datamapper properties have load_as == dump_as.

References: (search for value_loaded?)

@solnic, @emmanuel This time I am 99.9999% sure my thoughts are correct. I would also accept testing dumped_value against dump_as. But the purpose of
the primitive type rule is to catch cases the typecast was not able to
coerce a property value.

Committed by Markus Schirp

  • A spec/fixtures/integer_dumped_as_string_property.rb
  • M lib/data_mapper/validation/rule/primitive_type.rb
  • M spec/fixtures/memory_object.rb
  • M spec/integration/primitive_validator/primitive_validator_spec.rb
New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »