<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>cucumber.yml</filename>
    </added>
    <added>
      <filename>examples/lib/activerecord.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,19 +1,16 @@
 require 'rubygems'
 require 'spec/expectations'
 
-require 'activerecord'
-require '../../lib/database_cleaner'
+begin
+  require &quot;#{File.dirname(__FILE__)}/../../lib/#{ENV['ORM']}&quot;
+rescue LoadError
+  raise &quot;I don't have the setup for the '#{ENV['ORM']}' ORM!&quot;
+end
+
+$:.unshift(File.dirname(__FILE__) + '/../../../lib')
+require 'database_cleaner'
 require 'database_cleaner/cucumber'
 
-DatabaseCleaner.strategy = :transaction #DatabaseCleaner::ActiveRecord::Transaction.new
+DatabaseCleaner.strategy = ENV['STRATEGY'].to_sym
 
-ActiveRecord::Base.establish_connection(:adapter =&gt; &quot;sqlite3&quot;, :dbfile =&gt; &quot;:memory:&quot;)
 
-ActiveRecord::Schema.define(:version =&gt; 1) do
-  create_table :widgets do |t|
-    t.string :name
-  end
-end
-
-class Widget &lt; ActiveRecord::Base
-end</diff>
      <filename>examples/features/support/env.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,15 @@
-Feature: something something
-  In order to something something
-  A user something something
-  something something something
+Feature: database cleaning
+  In order to ease example and feature writing
+  As a developer
+  I want to have my database in a clean state
 
-  Scenario: something something
-    Given inspiration
-    When I create a sweet new gem
-    Then everyone should see how awesome I am
+  Scenario Outline: ruby app
+    Given I am using &lt;ORM&gt;
+    And the &lt;Strategy&gt; cleaning strategy
+
+    When I run my scenarios that rely on a clean database
+    Then I should see all green
+
+  Examples:
+    | ORM          | Strategy      |
+    | ActiveRecord | transaction   |</diff>
      <filename>features/cleaning.feature</filename>
    </modified>
    <modified>
      <diff>@@ -0,0 +1,25 @@
+Given /^I am using (ActiveRecord|DataMapper)$/ do |orm|
+  @orm = orm
+end
+
+Given /^the (.+) cleaning strategy$/ do |strategy|
+  @strategy = strategy
+end
+
+When &quot;I run my scenarios that rely on a clean database&quot; do
+  full_dir ||= File.expand_path(File.dirname(__FILE__) + &quot;/../../examples/&quot;)
+  Dir.chdir(full_dir) do
+    ENV['ORM'] = @orm.downcase
+    ENV['STRATEGY'] = @strategy
+    @out = `cucumber features`
+    @status = $?.exitstatus
+  end
+end
+
+Then &quot;I should see all green&quot; do
+  unless @status == 0
+    raise &quot;Expected to see all green but we saw FAIL! Output:\n#{@out}&quot;
+  end
+end
+
+</diff>
      <filename>features/step_definitions/database_cleaner_steps.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,26 @@
 module DatabaseCleaner::ActiveRecord
   class Transaction
 
+    def start
+      if ActiveRecord::Base.connection.respond_to?(:increment_open_transactions)
+        ActiveRecord::Base.connection.increment_open_transactions
+      else
+        ActiveRecord::Base.__send__(:increment_open_transactions)
+      end
+
+      ActiveRecord::Base.connection.begin_db_transaction
+    end
+
+
+    def clean
+      ActiveRecord::Base.connection.rollback_db_transaction
+
+      if ActiveRecord::Base.connection.respond_to?(:decrement_open_transactions)
+        ActiveRecord::Base.connection.decrement_open_transactions
+      else
+        ActiveRecord::Base.__send__(:decrement_open_transactions)
+      end
+    end
   end
 
 end</diff>
      <filename>lib/database_cleaner/active_record/transaction.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>13a59fc3af4cf80ed1ae7a5e09c490e8adc4bdcc</id>
    </parent>
  </parents>
  <author>
    <name>Ben Mabey</name>
    <email>ben@benmabey.com</email>
  </author>
  <url>http://github.com/bmabey/database_cleaner/commit/5e8df327d862e5100656cc67efad871c2793cf38</url>
  <id>5e8df327d862e5100656cc67efad871c2793cf38</id>
  <committed-date>2009-03-03T20:53:21-08:00</committed-date>
  <authored-date>2009-03-03T20:53:21-08:00</authored-date>
  <message>cucumber feature and example app done. Got the AR transaction strategy done as well.</message>
  <tree>f5954da88a6626a4a5756b03b0e5986aa203e2b7</tree>
  <committer>
    <name>Ben Mabey</name>
    <email>ben@benmabey.com</email>
  </committer>
</commit>
