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

25 lines
541 B
Ruby
Raw Normal View History

2019-06-04 03:40:48 +00:00
FactoryBot.define do
factory 'knowledge_base/menu_item', aliases: %i[knowledge_base_menu_item] do
kb_locale { nil }
sequence(:title) { |n| "menu_#{n}" }
url { Faker::Internet.url }
for_header
2019-06-04 03:40:48 +00:00
before :create do |menu_item|
if menu_item.kb_locale.blank?
kb = create(:knowledge_base)
menu_item.kb_locale = kb.kb_locales.first
end
end
trait :for_footer do
location { 'footer' }
end
trait :for_header do
location { 'header' }
end
2019-06-04 03:40:48 +00:00
end
end