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

16 lines
384 B
Ruby
Raw Normal View History

2019-06-04 03:40:48 +00:00
FactoryBot.define do
factory 'knowledge_base/answer', aliases: %i[knowledge_base_answer] do
transient do
add_translation { true }
end
2019-06-04 03:40:48 +00:00
category { create(:knowledge_base_category) }
before(:create) do |answer|
next if answer.translations.present?
answer.translations << build('knowledge_base/answer/translation', answer: answer)
end
2019-06-04 03:40:48 +00:00
end
end