2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2019-06-04 03:40:48 +00:00
|
|
|
FactoryBot.define do
|
|
|
|
factory 'knowledge_base/menu_item', aliases: %i[knowledge_base_menu_item] do
|
2020-05-13 17:01:42 +00:00
|
|
|
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
|
2020-05-13 17:01:42 +00:00
|
|
|
|
|
|
|
trait :for_footer do
|
|
|
|
location { 'footer' }
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :for_header do
|
|
|
|
location { 'header' }
|
|
|
|
end
|
2019-06-04 03:40:48 +00:00
|
|
|
end
|
|
|
|
end
|