Class: Brut::FactoryBot
- Inherits:
-
Object
- Object
- Brut::FactoryBot
- Defined in:
- lib/brut/factory_bot.rb
Overview
Encompasses a Brut app's FactoryBot configuration. This allows it to be used outside of tests.
Instance Method Summary collapse
-
#setup! ⇒ Object
Configures FactoryBot and finds all definitions.
Instance Method Details
#setup! ⇒ Object
Configures FactoryBot and finds all definitions. After this, calls like FactoryBot.create(...)
should work.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/brut/factory_bot.rb', line 7 def setup! Faker::Config.locale = :en FactoryBot.definition_file_paths = [ Brut.container.app_specs_dir / "factories" ] FactoryBot.define do to_create { |instance| instance.save } end FactoryBot.find_definitions end |