Given some YARD type-hinting context for a class, like
# == Schema Information
#
# Table name: items
#
# @!attribute id
# @return []
# @!attribute description
# @return [String]
# @!attribute title
# @return [String]
class Item < ApplicationRecord
end
Is it possible to get title/description type-hinting support by explicitly setting self
type-hinting type?
factory :item do
# ... ?
end
Please note, this question is FactoryBot agnostic.
The following solution seems to work although I'm not sure if there is a better way of doing it.
factory :item do
# @type [Item]
self_alias = self
self_alias. # suggests to autocomplete w/ id/title/description
end
An alternative solution(specific to FactorBot!) might be the following:
# @param model [Item]
factory :item do |model|
model. # suggests to autocomplete w/ id/title/description
end