Permalink
Browse files

Include DatabaseCleaner usage when demoing FactoryGirl.lint

Because built factories create associated records, the database may not
be empty when the suite is run. This encourages developers to start
DatabaseCleaner and clean after linting is complete to ensure a clean
database.
  • Loading branch information...
1 parent ea03790 commit 24bf4c4ea23fdc26e4dcc203b9c7e9a1a8c31e1a @joshuaclayton joshuaclayton committed Feb 13, 2014
Showing with 9 additions and 1 deletion.
  1. +9 −1 GETTING_STARTED.md
View
10 GETTING_STARTED.md
@@ -88,11 +88,19 @@ RSpec.configure do |config|
# additional factory_girl configuration
config.before(:suite) do
- FactoryGirl.lint
+ begin
+ DatabaseCleaner.start
+ FactoryGirl.lint
+ ensure
+ DatabaseCleaner.clean
+ end
end
end
```
+After calling `FactoryGirl.lint`, you'll likely want to clear out the
+database, as built factories will create associated records.
+
Defining factories
------------------

0 comments on commit 24bf4c4

Please sign in to comment.