<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -9,7 +9,7 @@ module DataMapper
       end
       
       def call(target)
-        field_value = target.instance_variable_get(&quot;@#{@field_name}&quot;).blank?
+        field_value = target.attribute_get(field_name).blank?
         return true if field_value
         
         error_message = @options[:message] || &quot;%s must be absent&quot;.t(DataMapper::Inflection.humanize(@field_name))</diff>
      <filename>dm-validations/lib/dm-validations/absent_field_validator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,7 +10,7 @@ module DataMapper
       end
       
       def call(target)      
-        value =  target.instance_variable_get(&quot;@#{@field_name}&quot;).to_s
+        value =  target.attribute_get(field_name).to_s
         regex = @options[:integer_only] ? /\A[+-]?\d+\Z/ : /^\d*\.{0,1}\d+$/
         return true if not (value =~ regex).nil?
         </diff>
      <filename>dm-validations/lib/dm-validations/numeric_validator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -412,6 +412,14 @@ begin
         validates_presence_of :name, :when =&gt; :property_test    
         validates_presence_of :landscaper, :when =&gt; :association_test    
       end
+      
+      class Fertilizer
+        include DataMapper::Resource
+        include DataMapper::Validate
+        property :id, Fixnum, :serial =&gt; true
+        property :brand, String, :auto_validation =&gt; false, :default =&gt; 'Scotts'
+        validates_presence_of :brand, :when =&gt; :property_test
+      end
     end
 
     it &quot;should validate the presence of a property value on an instance of a resource&quot; do
@@ -431,6 +439,10 @@ begin
     #  #puts &quot;Gardens landscaper is #{garden.landscaper.child_key}&quot;
     #end
     
+    it &quot;should pass when a default is available&quot; do
+      fert = Fertilizer.new
+      fert.should be_valid_for_property_test
+    end
   end
 
 
@@ -444,6 +456,13 @@ begin
               
         validates_absence_of :salesman, :when =&gt; :sold    
       end
+      
+      class Pirogue
+        include DataMapper::Resource
+        include DataMapper::Validate
+        property :salesman, String, :default =&gt; 'Layfayette'
+        validates_absence_of :salesman, :when =&gt; :sold
+      end
     end
 
     it &quot;should validate the absense of a value on an instance of a resource&quot; do
@@ -454,6 +473,11 @@ begin
       kayak.valid_for_sold?.should_not == true    
     end
     
+    it &quot;should validate the absense of a value and ensure defaults&quot; do
+      pirogue = Pirogue.new
+      pirogue.should_not be_valid_for_sold
+    end
+    
   end
 
   #-------------------------------------------------------------------------------
@@ -556,7 +580,7 @@ begin
       end
     end
     
-    it &quot;should validate the confrimation of a value on an instance of a resource&quot; do
+    it &quot;should validate the confirmation of a value on an instance of a resource&quot; do
       canoe = Canoe.new
       canoe.name = 'White Water'
       canoe.name_confirmation = 'Not confirmed'
@@ -567,7 +591,7 @@ begin
       canoe.valid?.should == true
     end
     
-    it &quot;should default the name of the confirimation field to &lt;field&gt;_confirmation if one is not specified&quot; do
+    it &quot;should default the name of the confirmation field to &lt;field&gt;_confirmation if one is not specified&quot; do
       canoe = Canoe.new
       canoe.name = 'White Water'
       canoe.name_confirmation = 'White Water'
@@ -740,6 +764,13 @@ end
         include DataMapper::Validate     
         property :name, String, :auto_validation =&gt; false   
       end
+      
+      class BoatDock
+        include DataMapper::Resource
+        include DataMapper::Validate
+        property :name, String, :auto_validation =&gt; false, :default =&gt; &quot;I'm a long string&quot;
+        validates_length_of :name, :min =&gt; 3
+      end
     end
 
     it 'should be able to set a minimum length of a string field' do
@@ -812,6 +843,11 @@ end
       launch.name = 'Ride'
       launch.valid?.should == true      
     end  
+    
+    it &quot;should pass if a default fufills the requirements&quot; do
+      doc = BoatDock.new
+      doc.should be_valid
+    end
   end
 
   #-------------------------------------------------------------------------------
@@ -890,6 +926,14 @@ end
         
         validates_numericalnes_of :amount_1, :amount_2      
       end
+      
+      class Hillary
+        include DataMapper::Resource
+        include DataMapper::Validate
+        property :amount_1, Float, :auto_validation =&gt; false, :default =&gt; 0.01
+        validates_numericalnes_of :amount_1
+        
+      end
     end
     
     it &quot;should validate a floating point value on the instance of a resource&quot; do
@@ -923,6 +967,11 @@ end
       
     end
     
+    it &quot;should validate if a default fufills the requirements&quot; do
+      h = Hillary.new
+      h.should be_valid
+    end
+    
   end  
 
 </diff>
      <filename>dm-validations/spec/validation_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a55dc09669177299de9d8c6f9d4a67bc8e9db980</id>
    </parent>
  </parents>
  <author>
    <name>Adam French</name>
    <email>adam@adam.wieck.com</email>
  </author>
  <url>http://github.com/sam/dm-more/commit/e3d72a8a9f1dd7fc68500c539e362444d6b118c6</url>
  <id>e3d72a8a9f1dd7fc68500c539e362444d6b118c6</id>
  <committed-date>2008-05-07T10:29:49-07:00</committed-date>
  <authored-date>2008-05-07T10:29:49-07:00</authored-date>
  <message>accounting for further defaults</message>
  <tree>9c61974e6af30deed99d2ec9bb89f4ca411b2b0b</tree>
  <committer>
    <name>Adam French</name>
    <email>adam@adam.wieck.com</email>
  </committer>
</commit>
