1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00

Simplify DatabaseCleaner code example for linter (#1009)

The `cleaning` method already ensures cleaning and provides for a way to write better looking code.

This should be 100% equivalent to previous example.
This commit is contained in:
Diego Algorta 2017-09-28 09:25:58 -03:00 committed by Josh Clayton
parent 07b796ecce
commit 1924bc0602

View file

@ -986,11 +986,8 @@ namespace :factory_girl do
desc "Verify that all FactoryGirl factories are valid"
task lint: :environment do
if Rails.env.test?
begin
DatabaseCleaner.start
DatabaseCleaner.cleaning do
FactoryGirl.lint
ensure
DatabaseCleaner.clean
end
else
system("bundle exec rake factory_girl:lint RAILS_ENV='test'")