updating the README.. we have had DM support for a while...

This commit is contained in:
Ben Mabey 2009-08-11 15:12:00 -06:00
parent 32986cf86b
commit 84b037bccb
1 changed files with 9 additions and 12 deletions

View File

@ -1,14 +1,11 @@
h1. Database Cleaner
Database Cleaner is a set of strategies for cleaning your database in Ruby.
The original use case was to ensure a clean state during tests. Each strategy
is a small amount of code but is code that is usually needed in any ruby app
The original use case was to ensure a clean state during tests. Each strategy
is a small amount of code but is code that is usually needed in any ruby app
that is testing with a database.
Right now the only ORM supported is ActiveRecord and it currently has two strategies:
truncation and transaction.
Support for DataMapper is built-in. All that needs to be written are the strategies. :)
Both ActiveRecord and DataMapper are supported.
h2. How to use
@ -32,14 +29,14 @@ With the :truncation strategy you can also pass in options, for example:
(I should point out the truncation strategy will never truncate your schema_migrations table.)
Some strategies require that you call DatabaseCleaner.start before calling clean
Some strategies require that you call DatabaseCleaner.start before calling clean
(for example the :transaction one needs to know to open up a transaction). So
you would have:
<pre>
require 'database_cleaner'
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.start # usually this is called in setup of a test
dirty_the_db
DatabaseCleaner.clean # cleanup of the test
@ -83,10 +80,10 @@ For use in Cucumber please see the section below.
h2. Why?
One of my motivations for writing this library was to have an easy way to
turn on what Rails calls "transactional_fixtures" in my non-rails
One of my motivations for writing this library was to have an easy way to
turn on what Rails calls "transactional_fixtures" in my non-rails
ActiveRecord projects. For example, Cucumber ships with a Rails world that
will wrap each scenario in a transaction. This is great, but what if you are
will wrap each scenario in a transaction. This is great, but what if you are
using ActiveRecord in a non-rails project? You used to have to copy-and-paste
the needed code, but with DatabaseCleaner you can now say:
@ -97,7 +94,7 @@ the needed code, but with DatabaseCleaner you can now say:
DatabaseCleaner.strategy = :transaction
</pre>
Now lets say you are running your features and it requires that another process be
Now lets say you are running your features and it requires that another process be
involved (i.e. Selenium running against your app's server.) You can simply change
your strategy type: