2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2021-07-19 12:24:09 +00:00
|
|
|
RSpec.shared_context 'basic Knowledge Base', current_user_id: 1 do # rubocop:disable RSpec/ContextWording
|
2019-09-18 17:25:04 +00:00
|
|
|
let :knowledge_base do
|
|
|
|
create(:knowledge_base)
|
|
|
|
end
|
|
|
|
|
|
|
|
let :primary_locale do
|
|
|
|
knowledge_base.translation_primary.kb_locale
|
|
|
|
end
|
|
|
|
|
2021-08-16 08:20:07 +00:00
|
|
|
let :locale_name do
|
|
|
|
primary_locale.system_locale.locale
|
|
|
|
end
|
|
|
|
|
2019-09-18 17:25:04 +00:00
|
|
|
let :alternative_locale do
|
|
|
|
create(:knowledge_base_locale, knowledge_base: knowledge_base, system_locale: Locale.find_by(locale: 'lt'))
|
|
|
|
end
|
|
|
|
|
|
|
|
let :category do
|
|
|
|
create(:knowledge_base_category, knowledge_base: knowledge_base)
|
|
|
|
end
|
|
|
|
|
2019-09-24 15:44:32 +00:00
|
|
|
let :draft_answer do
|
2019-09-18 17:25:04 +00:00
|
|
|
create(:knowledge_base_answer, category: category)
|
|
|
|
end
|
|
|
|
|
|
|
|
let :published_answer do
|
2020-08-05 13:48:41 +00:00
|
|
|
create(:knowledge_base_answer, :published, :with_attachment, category: category)
|
2019-09-18 17:25:04 +00:00
|
|
|
end
|
|
|
|
|
2020-02-19 17:07:52 +00:00
|
|
|
let :published_answer_with_video do
|
2020-08-05 13:48:41 +00:00
|
|
|
create(:knowledge_base_answer, :published, :with_video, category: category)
|
2020-02-19 17:07:52 +00:00
|
|
|
end
|
|
|
|
|
2021-08-16 08:20:07 +00:00
|
|
|
let :published_answer_with_tag do
|
|
|
|
create(:knowledge_base_answer, :published, :with_tag, tag_names: [published_answer_tag_name], category: category)
|
|
|
|
end
|
|
|
|
|
|
|
|
let(:published_answer_tag_name) do
|
|
|
|
'example_kb_tag'
|
|
|
|
end
|
|
|
|
|
2019-09-18 17:25:04 +00:00
|
|
|
let :internal_answer do
|
2020-08-05 13:48:41 +00:00
|
|
|
create(:knowledge_base_answer, :internal, category: category)
|
2019-09-18 17:25:04 +00:00
|
|
|
end
|
2019-11-12 14:08:00 +00:00
|
|
|
|
|
|
|
let :archived_answer do
|
2020-08-05 13:48:41 +00:00
|
|
|
create(:knowledge_base_answer, :archived, category: category)
|
2019-11-12 14:08:00 +00:00
|
|
|
end
|
2019-09-18 17:25:04 +00:00
|
|
|
end
|
2020-05-13 17:01:42 +00:00
|
|
|
|
2021-07-19 12:24:09 +00:00
|
|
|
RSpec.shared_context 'Knowledge Base menu items', current_user_id: 1 do # rubocop:disable RSpec/ContextWording
|
|
|
|
# rubocop:disable RSpec/LetSetup
|
2020-05-13 17:01:42 +00:00
|
|
|
let!(:menu_item_1) { create(:knowledge_base_menu_item, :for_header, kb_locale: primary_locale) }
|
|
|
|
let!(:menu_item_2) { create(:knowledge_base_menu_item, :for_header, kb_locale: primary_locale) }
|
|
|
|
let!(:menu_item_3) { create(:knowledge_base_menu_item, :for_footer, kb_locale: primary_locale) }
|
|
|
|
let!(:menu_item_4) { create(:knowledge_base_menu_item, :for_footer, kb_locale: alternative_locale) }
|
|
|
|
let!(:menu_item_5) { create(:knowledge_base_menu_item, :for_footer, kb_locale: alternative_locale) }
|
2021-07-19 12:24:09 +00:00
|
|
|
# rubocop:enable RSpec/LetSetup
|
2020-05-13 17:01:42 +00:00
|
|
|
end
|