trabajo-afectivo/spec/factories/knowledge_base/answer/translation.rb

16 lines
556 B
Ruby
Raw Normal View History

2019-06-04 03:40:48 +00:00
FactoryBot.define do
factory 'knowledge_base/answer/translation', aliases: %i[knowledge_base_answer_translation] do
answer { nil }
kb_locale { nil }
title { Faker::Appliance.equipment }
content { build(:knowledge_base_answer_translation_content) }
before(:create) do |translation|
if translation.answer.nil? && translation.kb_locale.nil?
translation.answer = create(:knowledge_base_answer)
translation.kb_locale = translation.answer.category.knowledge_base.kb_locales.first
end
end
end
end