<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -351,7 +351,7 @@ class Factory
   end
 
   def attribute_defined? (name)
-    !@attributes.detect {|attr| attr.name == name }.nil?
+    !@attributes.detect {|attr| attr.name == name &amp;&amp; !attr.is_a?(Factory::Attribute::Callback) }.nil?
   end
 
   def assert_valid_options(options)</diff>
      <filename>lib/factory_girl/factory.rb</filename>
    </modified>
    <modified>
      <diff>@@ -458,6 +458,20 @@ describe Factory do
       child.attributes.size.should == 1
       child.attributes.first.should be_kind_of(Factory::Attribute::Dynamic)
     end
+
+    it &quot;inherit all callbacks&quot; do
+      Factory.define(:child, :parent =&gt; :object) do |f|
+        f.after_stub {|o| o.name = 'Stubby' }
+      end
+
+      grandchild = Factory.define(:grandchild, :parent =&gt; :child) do |f|
+        f.after_stub {|o| o.name = &quot;#{o.name} McStubby&quot; }
+      end
+
+      grandchild.attributes.size.should == 3
+      grandchild.attributes.first.should be_kind_of(Factory::Attribute::Callback)
+      grandchild.attributes[1].should be_kind_of(Factory::Attribute::Callback)
+    end
   end
 
   describe 'defining a factory with a default strategy parameter' do</diff>
      <filename>spec/factory_girl/factory_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -46,11 +46,11 @@ describe Factory::Proxy::Stub do
     end
 
     describe &quot;when asked for the result&quot; do
-      it &quot;should return the actual instance when asked for the result&quot; do
+      it &quot;should return the actual instance&quot; do
         @stub.result.should == @instance
       end
 
-      it &quot;should run the :after_stub callback when asked for the result&quot; do
+      it &quot;should run the :after_stub callback&quot; do
         @spy = Object.new
         stub(@spy).foo
         @stub.add_callback(:after_stub, proc{ @spy.foo })</diff>
      <filename>spec/factory_girl/proxy/stub_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -37,6 +37,10 @@ describe &quot;integration&quot; do
       f.after_create {|u| u.last_name  = 'Createy' }
     end
 
+    Factory.define :user_with_inherited_callbacks, :parent =&gt; :user_with_callbacks do |f|
+      f.callback(:after_stub) {|u| u.last_name = 'Double-Stubby' }
+    end
+
     Factory.define :business do |f|
       f.name 'Supplier of Awesome'
       f.association :owner, :factory =&gt; :user
@@ -290,5 +294,11 @@ describe &quot;integration&quot; do
       @user.first_name.should == 'Buildy'
       @user.last_name.should == 'Createy'
     end
+
+    it &quot;should run both the after_stub callback on the factory and the inherited after_stub callback&quot; do
+      @user = Factory.stub(:user_with_inherited_callbacks)
+      @user.first_name.should == 'Stubby'
+      @user.last_name.should == 'Double-Stubby'
+    end
   end
 end</diff>
      <filename>spec/integration_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6e35bf92071f4b34763e6d0d12ebef8f7eab4d4b</id>
    </parent>
  </parents>
  <author>
    <name>Nathan Sutton</name>
    <email>nate@sevenwire.com</email>
  </author>
  <url>http://github.com/thoughtbot/factory_girl/commit/8f3b24a559aec25d058734bdd94fbbb774b89957</url>
  <id>8f3b24a559aec25d058734bdd94fbbb774b89957</id>
  <committed-date>2009-10-09T22:23:57-07:00</committed-date>
  <authored-date>2009-10-09T22:23:57-07:00</authored-date>
  <message>Fixing inheritance of callbacks

Since callbacks share the same names they wouldn't be inherited.
I added a check to allow them to be inherited.</message>
  <tree>3a6db513de4d984d6eaa4ce5262f0fc6b7b022e5</tree>
  <committer>
    <name>Nathan Sutton</name>
    <email>nate@sevenwire.com</email>
  </committer>
</commit>
