template.rb 1.0 KB

123456789101112131415161718192021222324252627282930313233
  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. end
  17. trait :dummy_data do
  18. options do
  19. {
  20. 'ticket.formSenderType' => { value: sender_type },
  21. 'ticket.title' => { value: title },
  22. 'article.body' => { value: body },
  23. 'ticket.customer_id' => { value: customer.id, value_completion: "#{customer.firstname} #{customer.lastname} <#{customer.email}>" },
  24. 'ticket.group_id' => { value: group.id },
  25. 'ticket.owner_id' => { value: owner.id },
  26. }
  27. end
  28. end
  29. end
  30. end