openSUSE/osem

View on GitHub
lib/tasks/factory_bot.rake

Summary

Maintainability
Test Coverage
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