class FactoryBot::Attribute::Association

@api private

Attributes

factory[R]

Public Class Methods

new(name, factory, overrides) click to toggle source
Calls superclass method FactoryBot::Attribute::new
# File lib/factory_bot/attribute/association.rb, line 7
def initialize(name, factory, overrides)
  super(name, false)
  @factory = factory
  @overrides = overrides
end

Public Instance Methods

association?() click to toggle source
# File lib/factory_bot/attribute/association.rb, line 22
def association?
  true
end
to_proc() click to toggle source
# File lib/factory_bot/attribute/association.rb, line 13
def to_proc
  factory = @factory
  overrides = @overrides
  traits_and_overrides = [factory, overrides].flatten
  factory_name = traits_and_overrides.shift

  -> { association(factory_name, *traits_and_overrides) }
end