sla.rb 671 B

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