<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,7 @@
+= Version 0.2.0 (2009-05-20)
+
+Added clean_up options
+
 = Version 0.1.4 (2009-03-25)
 
 Added a_number to allow the generation of unique integers</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -32,6 +32,22 @@ If you want to generate a unique value yourself, you can use Object::Factory's n
 
   :generate =&gt; { :field =&gt; &quot;unique-value-#{a_number}&quot; }
 
+== Cleaning up
+
+(currently only for ActiveRecord)
+
+If you register your (ActiveRecord) class with the clean_up option, then the factory can ensure that all instances are deleted.  This is useful if you cannot use transactional_fixtures (for example using Watir or Culerity in your test suite).  
+
+Add a clean_up parameter when registering your classes: 
+  
+  when_creating_a Person, :auto_generate =&gt; [:first_name, :last_name], :clean_up =&gt; true
+  
+Then in your &quot;after&quot; section call: 
+
+  Object.factory.clean_up
+  
+This will call delete_all on any registered classes (hence it is currently ActiveRecord only).  
+
 == Rails
 
 To use this with rails, stick the following in your +environment.rb+:</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@ require 'rubygems'
 require 'rake'
 require 'echoe'
 
-Echoe.new('object-factory', '0.1.4') do | config | 
+Echoe.new('object-factory', '0.2.0') do | config | 
   config.description = 'A simple object factory to help you build valid objects in your tests'
   config.url = 'http://github.com/brightbox/object-factory'
   config.author = 'Brightbox Systems Ltd'</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -25,6 +25,14 @@ class Object
     def reset
       @confirmed_fields = {}
       @generators = {}
+      @classes_for_clean_up = []
+    end
+    
+    # clean up all instances
+    def clean_up
+      @classes_for_clean_up.each do | klass | 
+        klass.delete_all
+      end
     end
   
     # Create a new instance of the given class with the given parameters and apply the auto-generated fields, according to the configured rules
@@ -59,6 +67,7 @@ class Object
       need_to_generate_ip_addresses_for klass, options[:generate_ip_address] unless options[:generate_ip_address].nil?
       need_to_set_values_for klass, options[:set] unless options[:set].nil? 
       need_to_set_generators_for klass, options[:generate] unless options[:generate].nil?
+      register_for_clean_up klass if options[:clean_up]
     end
     
     alias :when_creating_an :when_creating_a
@@ -102,7 +111,7 @@ class Object
       end
     end
     
-    private
+  private
       
     def symbol_for object
       klass = object.is_a?(Class) ? object : object.class
@@ -175,6 +184,10 @@ class Object
         instance.send(&quot;#{field_name.to_sym}=&quot;.to_sym, value) unless parameters.has_key?(field_name.to_sym)
       end
     end
+    
+    def register_for_clean_up klass
+      @classes_for_clean_up &lt;&lt; klass
+    end
   end
   
 end</diff>
      <filename>lib/object_factory.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,11 +2,11 @@
 
 Gem::Specification.new do |s|
   s.name = %q{object-factory}
-  s.version = &quot;0.1.4&quot;
+  s.version = &quot;0.2.0&quot;
 
   s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 1.2&quot;) if s.respond_to? :required_rubygems_version=
   s.authors = [&quot;Brightbox Systems Ltd&quot;]
-  s.date = %q{2008-12-08}
+  s.date = %q{2009-05-20}
   s.description = %q{A simple object factory to help you build valid objects in your tests}
   s.email = %q{hello@brightbox.co.uk}
   s.extra_rdoc_files = [&quot;CHANGELOG&quot;, &quot;lib/object_factory.rb&quot;, &quot;README.rdoc&quot;, &quot;tasks/rspec.rake&quot;]</diff>
      <filename>object-factory.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -318,4 +318,20 @@ describe Object::Factory, &quot;generating sequential numbers&quot; do
     Object.factory.should_receive(:next_number).and_return(1)
     number = a_number
   end
+end
+
+describe Object::Factory, &quot;cleaning up ActiveRecord models&quot; do
+  before :each do
+    Object.factory.reset
+  end
+  
+  it &quot;should delete all instances for registered classes&quot; do
+    Object.factory.when_creating_a TestClass, :auto_confirm =&gt; :password, :clean_up =&gt; true
+    Object.factory.when_creating_an AnotherTestClass, :clean_up =&gt; true
+    
+    TestClass.should_receive(:delete_all).and_return(0)
+    AnotherTestClass.should_receive(:delete_all).and_return(0)
+    
+    Object.factory.clean_up
+  end
 end
\ No newline at end of file</diff>
      <filename>spec/object_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a6e9e1d18c98a491e7e2e86f7078053ff0940152</id>
    </parent>
  </parents>
  <author>
    <name>Rahoul Baruah</name>
    <email>rahoul@brightbox.co.uk</email>
  </author>
  <url>http://github.com/brightbox/object-factory/commit/b5dad1e6be0bf18b399661fd0a9b86c8e5f12434</url>
  <id>b5dad1e6be0bf18b399661fd0a9b86c8e5f12434</id>
  <committed-date>2009-05-20T14:00:53-07:00</committed-date>
  <authored-date>2009-05-20T14:00:53-07:00</authored-date>
  <message>added the clean up option</message>
  <tree>e06ca642f1c3d8f5a6b2109def7173edff4d3726</tree>
  <committer>
    <name>Rahoul Baruah</name>
    <email>rahoul@brightbox.co.uk</email>
  </committer>
</commit>
