From 7f31ba9239fcad8e2fbbf19c84d6dd516e37dab5 Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Thu, 13 Feb 2014 11:49:31 -0500 Subject: [PATCH] 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. Closes #619, #611, #620 --- GETTING_STARTED.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index f746c5b..b8d3d89 100644 --- a/GETTING_STARTED.md +++ b/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 ------------------