checklist.rb 527 B

12345678910111213141516171819202122
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. FactoryBot.define do
  3. factory :checklist do
  4. name { '' }
  5. updated_by_id { 1 }
  6. created_by_id { 1 }
  7. sorted_item_ids { [] }
  8. ticket { association :ticket, **{ group: Group.first }.compact }
  9. transient do
  10. item_count { 5 }
  11. end
  12. after(:create) do |checklist, context|
  13. next if context.item_count.blank?
  14. create_list(:checklist_item, context.item_count, checklist: checklist)
  15. end
  16. end
  17. end