sla.rb 741 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. FactoryBot.define do
  3. factory :sla do
  4. calendar
  5. sequence(:name) { |n| "SLA #{n}" }
  6. created_by_id { 1 }
  7. updated_by_id { 1 }
  8. condition do
  9. {
  10. 'ticket.state_id' => {
  11. operator: 'is',
  12. value: Ticket::State.by_category_ids(:open),
  13. },
  14. }
  15. end
  16. trait :condition_blank do
  17. condition do
  18. {}
  19. end
  20. end
  21. trait :condition_title do
  22. transient do
  23. condition_title { nil }
  24. end
  25. condition do
  26. {
  27. 'ticket.title' => {
  28. operator: 'contains',
  29. value: condition_title
  30. }
  31. }
  32. end
  33. end
  34. end
  35. end