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
This commit is contained in:
parent
ea03790b3e
commit
7f31ba9239
|
@ -88,11 +88,19 @@ RSpec.configure do |config|
|
||||||
# additional factory_girl configuration
|
# additional factory_girl configuration
|
||||||
|
|
||||||
config.before(:suite) do
|
config.before(:suite) do
|
||||||
|
begin
|
||||||
|
DatabaseCleaner.start
|
||||||
FactoryGirl.lint
|
FactoryGirl.lint
|
||||||
|
ensure
|
||||||
|
DatabaseCleaner.clean
|
||||||
|
end
|
||||||
end
|
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
|
Defining factories
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue