2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2019-09-18 17:25:04 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2021-11-04 13:40:58 +00:00
|
|
|
RSpec.describe 'Public Knowledge Base for editor', authentication_type: :form, type: :system do
|
2019-09-18 17:25:04 +00:00
|
|
|
include_context 'basic Knowledge Base'
|
|
|
|
|
|
|
|
before do
|
2019-09-24 15:44:32 +00:00
|
|
|
published_answer && draft_answer && internal_answer
|
2019-09-18 17:25:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'homepage' do
|
|
|
|
before { visit help_no_locale_path }
|
|
|
|
|
2019-10-22 09:40:35 +00:00
|
|
|
it { expect(page).to have_editor_bar }
|
2019-09-18 17:25:04 +00:00
|
|
|
|
|
|
|
it 'expect to have edit button' do
|
|
|
|
button = find '.topbar-btn'
|
2021-05-12 11:37:44 +00:00
|
|
|
expect(button['href']).to match(%r{edit$})
|
2019-09-18 17:25:04 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'category' do
|
|
|
|
before { visit help_category_path(primary_locale.system_locale.locale, category) }
|
|
|
|
|
|
|
|
it 'shows published answer' do
|
|
|
|
within '.main' do
|
|
|
|
expect(page).to have_selector(:link_containing, published_answer.translation.title)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows draft answer' do
|
|
|
|
within '.main' do
|
2019-09-24 15:44:32 +00:00
|
|
|
expect(page).to have_selector(:link_containing, draft_answer.translation.title)
|
2019-09-18 17:25:04 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows internal answer' do
|
|
|
|
within '.main' do
|
|
|
|
expect(page).to have_selector(:link_containing, internal_answer.translation.title)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|