Method: Factory.build

Defined in:
lib/factory_girl/factory.rb

.build(name, overrides = {}) ⇒ Object

Generates and returns an instance from this factory. Attributes can be individually overridden by passing in a Hash of attribute => value pairs.

Arguments:

  • name: Symbol or String The name of the factory that should be used.

  • overrides: Hash Attributes to overwrite for this instance.

Returns: Object An instance of the class this factory generates, with generated attributes assigned.



216
217
218
# File 'lib/factory_girl/factory.rb', line 216

def self.build (name, overrides = {})
  factory_by_name(name).run(Proxy::Build, overrides)
end