Jets Factory
FactoryBot utilities for apps and engines.
Includes:
- faker (with only English locale loaded)
-
ActiveSupport.on_load(:factory_bot)
hook to configurefactory_bot
prior to loading definitions -
factory_bot_rails
(if Rails is defined)
Usage
Require it instead of factory_bot
(or factory_bot_rails
) and use as always:
require "jets-factory"
Active Support load hook
The load hook could be used to tell FactoryBot where to look for factory definitions:
ActiveSupport.on_load(:factory_bot) do
FactoryBot.definition_file_paths.unshift File.join(__dir__, "../spec/factories")
end
Why a separate gem and not a part of jets-testing
?
Factories could be used not only in test env, but in development and production (e.g., for DB seeds and mailers previews).