knowledge_base.rb 719 B

1234567891011121314151617181920212223242526
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. FactoryBot.define do
  3. factory :knowledge_base do
  4. transient do
  5. given_kb_locale { nil }
  6. end
  7. iconset { 'FontAwesome' }
  8. color_highlight { '#AAA' }
  9. color_header { '#EEE' }
  10. color_header_link { '#FFF000' }
  11. homepage_layout { 'grid' }
  12. category_layout { 'list' }
  13. before :create do |kb, context|
  14. if context.given_kb_locale.present?
  15. kb.kb_locales << context.given_kb_locale
  16. context.given_kb_locale.knowledge_base = kb
  17. end
  18. if kb.kb_locales.blank?
  19. kb.kb_locales << build(:knowledge_base_locale, knowledge_base: kb, primary: true)
  20. end
  21. end
  22. end
  23. end