history.rb 841 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. FactoryBot.define do
  3. factory :history do
  4. transient do
  5. o { Ticket.first }
  6. history_type { 'update' }
  7. history_attribute { 'state' }
  8. related_history_object { nil }
  9. end
  10. o_id { o.id }
  11. created_by_id { 1 }
  12. history_type_id do
  13. History.type_lookup(history_type).id
  14. end
  15. history_attribute_id do
  16. History.attribute_lookup(history_attribute).id
  17. end
  18. history_object_id do
  19. History.object_lookup(o.class.name).id
  20. end
  21. related_history_object_id do
  22. next if related_history_object.blank?
  23. History.object_lookup(related_history_object.class.name).id
  24. end
  25. related_o_id do
  26. next if related_history_object.blank?
  27. related_history_object.id
  28. end
  29. end
  30. end