Method: FactoryGirl::Syntax::Methods#create_list
- Defined in:
- lib/factory_girl/syntax/methods.rb
#create_list(name, amount, overrides = {}) ⇒ Object
Creates and returns multiple instances from this factory as an array. Attributes can be individually overridden by passing in a Hash of attribute => value pairs.
Arguments:
-
name:
Symbol
orString
The name of the factory to be used. -
amount:
Integer
number of instances to be created. -
overrides:
Hash
Attributes to overwrite for each instance.
Returns: Array
An array of instances of the class this factory generates, with generated attributes assigned.
113 114 115 |
# File 'lib/factory_girl/syntax/methods.rb', line 113 def create_list(name, amount, overrides = {}) amount.times.map { create(name, overrides) } end |