core_workflow.rb 991 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. FactoryBot.define do
  3. factory :core_workflow do
  4. sequence(:name) { |n| "Test CoreWorkflow #{n}" }
  5. sequence(:priority) { |n| n }
  6. changeable { false }
  7. created_by_id { 1 }
  8. updated_by_id { 1 }
  9. trait :active_and_screen do
  10. transient do
  11. screen { 'edit' }
  12. end
  13. preferences { { screen: screen } }
  14. active { true }
  15. end
  16. trait :condition_group do
  17. transient do
  18. group { nil }
  19. end
  20. condition_saved do
  21. { 'ticket.group_id': { operator: 'is', value: group.id.to_s } }
  22. end
  23. end
  24. trait :perform_action do
  25. transient do
  26. object_name { 'Ticket' }
  27. key { 'ticket.priority_id' }
  28. operator { 'remove_option' }
  29. value { '3' }
  30. end
  31. perform do
  32. { key => { operator: operator, operator => value } }
  33. end
  34. object { object_name }
  35. end
  36. end
  37. end