class FactoryBot::DefinitionProxy

def traits_for_enum(attribute_name, values = nil)

class method.
attempt to get the values by calling the pluralized `attribute_name`
those traits. When this argument is not provided, factory_bot will
An array of trait names, or a mapping of trait names to values for
values: +Array+, +Hash+, or other +Enumerable+
the name of the attribute these traits will set the value of
attribute_name: +Symbol+ or +String+
Arguments:


end
end
status { 2 }
trait :finished do

end
status { 1 }
trait :started do
factory :task do
Both equivalent to:

end
traits_for_enum :status
factory :task do

end
end
{started: 1, finished: 2}
def statuses
class Task
Example:

end
traits_for_enum :status, {started: 1, finished: 2}
factory :task do
Example:

end
end
status { :finished }
trait :finished do

end
status { :started }
trait :started do
factory :task do
Equivalent to:

end
traits_for_enum :status, [:started, :finished]
factory :task do
Example:

Creates traits for enumerable values.
def traits_for_enum(attribute_name, values = nil)
  @definition.register_enum(Enum.new(attribute_name, values))
end