job.rb 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. FactoryBot.define do
  2. factory :job do
  3. sequence(:name) { |n| "Test job #{n}" }
  4. condition { { 'ticket.state_id' => { 'operator' => 'is not', 'value' => 4 } } }
  5. perform { { 'ticket.state_id' => { 'value' => 4 } } }
  6. active { true }
  7. created_by_id { 1 }
  8. updated_by_id { 1 }
  9. timeplan do
  10. { days: { Mon: true,
  11. Tue: false,
  12. Wed: false,
  13. Thu: false,
  14. Fri: false,
  15. Sat: false,
  16. Sun: false },
  17. hours: { 0 => true,
  18. 1 => false,
  19. 2 => false,
  20. 3 => false,
  21. 4 => false,
  22. 5 => false,
  23. 6 => false,
  24. 7 => false,
  25. 8 => false,
  26. 9 => false,
  27. 10 => false,
  28. 11 => false,
  29. 12 => false,
  30. 13 => false,
  31. 14 => false,
  32. 15 => false,
  33. 16 => false,
  34. 17 => false,
  35. 18 => false,
  36. 19 => false,
  37. 20 => false,
  38. 21 => false,
  39. 22 => false,
  40. 23 => false },
  41. minutes: { 0 => true,
  42. 10 => false,
  43. 20 => false,
  44. 30 => false,
  45. 40 => false,
  46. 50 => false } }
  47. end
  48. trait :always_on do
  49. timeplan do
  50. { days: { Mon: true,
  51. Tue: true,
  52. Wed: true,
  53. Thu: true,
  54. Fri: true,
  55. Sat: true,
  56. Sun: true },
  57. hours: { 0 => true,
  58. 1 => true,
  59. 2 => true,
  60. 3 => true,
  61. 4 => true,
  62. 5 => true,
  63. 6 => true,
  64. 7 => true,
  65. 8 => true,
  66. 9 => true,
  67. 10 => true,
  68. 11 => true,
  69. 12 => true,
  70. 13 => true,
  71. 14 => true,
  72. 15 => true,
  73. 16 => true,
  74. 17 => true,
  75. 18 => true,
  76. 19 => true,
  77. 20 => true,
  78. 21 => true,
  79. 22 => true,
  80. 23 => true },
  81. minutes: { 0 => true,
  82. 10 => true,
  83. 20 => true,
  84. 30 => true,
  85. 40 => true,
  86. 50 => true } }
  87. end
  88. end
  89. trait :never_on do
  90. timeplan do
  91. { days: { Mon: false,
  92. Tue: false,
  93. Wed: false,
  94. Thu: false,
  95. Fri: false,
  96. Sat: false,
  97. Sun: false },
  98. hours: { 0 => false,
  99. 1 => false,
  100. 2 => false,
  101. 3 => false,
  102. 4 => false,
  103. 5 => false,
  104. 6 => false,
  105. 7 => false,
  106. 8 => false,
  107. 9 => false,
  108. 10 => false,
  109. 11 => false,
  110. 12 => false,
  111. 13 => false,
  112. 14 => false,
  113. 15 => false,
  114. 16 => false,
  115. 17 => false,
  116. 18 => false,
  117. 19 => false,
  118. 20 => false,
  119. 21 => false,
  120. 22 => false,
  121. 23 => false },
  122. minutes: { 0 => false,
  123. 10 => false,
  124. 20 => false,
  125. 30 => false,
  126. 40 => false,
  127. 50 => false } }
  128. end
  129. end
  130. end
  131. end