Files
osem/lib/tasks/factory_bot.rake
Henne Vogelsang 7dbe2d19fe Move factory linting to CI cycle
No need to do this before each and every spec or example. Speeds
up suite and make things less fragile.
2021-08-18 14:38:55 +02:00

15 lines
384 B
Ruby

namespace :factory_bot do
desc "Verify that all FactoryBot factories are valid"
task lint: :environment do
if Rails.env.test?
conn = ActiveRecord::Base.connection
conn.transaction do
FactoryBot.lint
raise ActiveRecord::Rollback
end
else
raise "\nERROR: You should not run this outside the test environment...\n\n"
end
end
end