Module: Synthra::FactoryBotIntegration::DSL

Defined in:
lib/synthra/factory_bot_integration.rb

Overview

DSL methods available inside factory definition blocks

Instance Method Summary collapse

Instance Method Details

#trait(name) { ... } ⇒ Object

Define a trait for the factory

Parameters:

  • name (Symbol)

    trait name

Yields:

  • block that returns field overrides



133
134
135
136
137
# File 'lib/synthra/factory_bot_integration.rb', line 133

def trait(name, &block)
  # Store the trait for later use
  @current_factory_traits ||= {}
  @current_factory_traits[name] = block
end