FactoryBot.define do factory :task_template, class: 'Ecom::Core::TaskTemplate' do code { FFaker::Name.name } name { FFaker::Name.name } description { FFaker::Name.name } association :task_template_type factory :task_template_with_product_template do after :create do |task_template, _| create(:work_product_template, task_template: task_template) end end end end