tag.rb 347 B

123456789101112131415
  1. FactoryBot.define do
  2. factory :tag do
  3. transient do
  4. o { Ticket.first }
  5. end
  6. tag_item_id { Tag::Item.lookup_by_name_and_create('blub').id }
  7. o_id { o.id }
  8. created_by_id { 1 }
  9. tag_object_id do
  10. Tag::Object.lookup(name: o.class.name)&.id || create(:'tag/object', name: o.class.name).id
  11. end
  12. end
  13. end