2019-09-18 17:25:04 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2020-06-18 11:51:25 +00:00
|
|
|
RSpec.describe 'Public Knowledge Base for editor', type: :system, authenticated_as: true 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'
|
|
|
|
expect(button['href']).to match(/edit$/)
|
|
|
|
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
|