mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
This significantly improves start time of tests. It is also the recommended way: https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#linting-factories Read more at: https://github.com/thoughtbot/factory_girl/issues/772
15 lines
351 B
Ruby
15 lines
351 B
Ruby
namespace :factory_girl do
|
|
desc "Verify that all FactoryGirl factories are valid"
|
|
task lint: :environment do
|
|
if Rails.env.test?
|
|
begin
|
|
DatabaseCleaner.start
|
|
FactoryGirl.lint
|
|
ensure
|
|
DatabaseCleaner.clean
|
|
end
|
|
else
|
|
system("bundle exec rake factory_girl:lint RAILS_ENV='test'")
|
|
end
|
|
end
|
|
end
|