Class: FactoryBot::DefinitionProxy
- Inherits:
-
Object
- Object
- FactoryBot::DefinitionProxy
- Defined in:
- lib/ledger_sync/test/support/factory_bot.rb
Instance Method Summary collapse
-
#references_many(name, count: 0, factory: nil) ⇒ FactoryBot::Declaration
Helper method of our references_many on resources.
-
#references_one(name, factory: nil) ⇒ FactoryBot::Declaration
Helper method of our references_one on resources.
Instance Method Details
#references_many(name, count: 0, factory: nil) ⇒ FactoryBot::Declaration
Helper method of our references_many on resources
132 133 134 135 136 137 |
# File 'lib/ledger_sync/test/support/factory_bot.rb', line 132 def references_many(name, count: 0, factory: nil) add_attribute(name) do factory ||= name FactoryBot.build_list(factory, count) end end |
#references_one(name, factory: nil) ⇒ FactoryBot::Declaration
Helper method of our references_one on resources
117 118 119 120 121 122 |
# File 'lib/ledger_sync/test/support/factory_bot.rb', line 117 def references_one(name, factory: nil) add_attribute(name) do factory ||= name FactoryBot.build(factory, **attributes_for(factory)) end end |