tag.rb 444 B

123456789101112131415161718
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. FactoryBot.define do
  3. factory :tag do
  4. transient do
  5. o { Ticket.first }
  6. tag { 'blub' }
  7. end
  8. tag_item_id { Tag::Item.lookup_by_name_and_create(tag).id }
  9. o_id { o.id }
  10. created_by_id { 1 }
  11. tag_object_id do
  12. Tag::Object.lookup(name: o.class.name)&.id || create(:'tag/object', name: o.class.name).id
  13. end
  14. end
  15. end