class FactoryBot::Syntax::Default::DSL
def self.run(block)
def self.run(block) new.instance_eval(&block) end
def factory(name, options = {}, &block)
def factory(name, options = {}, &block) factory = Factory.new(name, options) proxy = FactoryBot::DefinitionProxy.new(factory.definition) proxy.instance_eval(&block) if block Internal.register_factory(factory) proxy.child_factories.each do |(child_name, child_options, child_block)| parent_factory = child_options.delete(:parent) || name factory(child_name, child_options.merge(parent: parent_factory), &child_block) end end
def sequence(name, ...)
def sequence(name, ...) Internal.register_sequence(Sequence.new(name, ...)) end
def trait(name, &block)
def trait(name, &block) Internal.register_trait(Trait.new(name, &block)) end