Class: FactoryBot::Syntax::Default::ModifyDSL

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_bot/syntax/default.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run(block) ⇒ Object


68
69
70
# File 'lib/factory_bot/syntax/default.rb', line 68

def self.run(block)
  new.instance_eval(&block)
end

Instance Method Details

#factory(name, options = {}, &block) ⇒ Object


62
63
64
65
66
# File 'lib/factory_bot/syntax/default.rb', line 62

def factory(name, options = {}, &block)
  factory = FactoryBot.factory_by_name(name)
  proxy = FactoryBot::DefinitionProxy.new(factory.definition.overridable)
  proxy.instance_eval(&block)
end