template.rb 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. FactoryBot.define do
  3. factory :template do
  4. name { Faker::Name.unique.name }
  5. options { { 'ticket.title': { value: 'Some dummy title' } } }
  6. updated_by_id { 1 }
  7. created_by_id { 1 }
  8. active { true }
  9. transient do
  10. title { 'Title dummy.' }
  11. body { 'Content dummy.' }
  12. sender_type { 'email-out' }
  13. customer { association :customer }
  14. group { Group.first }
  15. owner { association :agent }
  16. tags { [] }
  17. end
  18. trait :dummy_data do
  19. options do
  20. {
  21. 'ticket.formSenderType' => { value: sender_type },
  22. 'ticket.title' => { value: title },
  23. 'article.body' => { value: body },
  24. 'ticket.customer_id' => { value: customer.id, value_completion: "#{customer.firstname} #{customer.lastname} <#{customer.email}>" },
  25. 'ticket.group_id' => { value: group.id },
  26. 'ticket.owner_id' => { value: owner.id },
  27. 'ticket.tags' => { value: tags.join(',') }
  28. }
  29. end
  30. end
  31. end
  32. end