Fixes #3915 - No longer public KB answers do not return http 404
This commit is contained in:
parent
cc9977460e
commit
4acf9cac67
2 changed files with 39 additions and 1 deletions
|
@ -105,6 +105,6 @@ class KnowledgeBase::Public::BaseController < ApplicationController
|
|||
end
|
||||
|
||||
@page_title_error = :not_found
|
||||
render 'knowledge_base/public/not_found'
|
||||
render 'knowledge_base/public/not_found', status: :not_found
|
||||
end
|
||||
end
|
||||
|
|
38
spec/requests/knowledge_base_public/answers_spec.rb
Normal file
38
spec/requests/knowledge_base_public/answers_spec.rb
Normal file
|
@ -0,0 +1,38 @@
|
|||
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'KnowledgeBase public answers', type: :request do
|
||||
include_context 'basic Knowledge Base'
|
||||
|
||||
describe '#show' do
|
||||
context 'when visitor is a guest' do
|
||||
it 'returns OK for published answer' do
|
||||
get help_answer_path(locale_name, category, published_answer)
|
||||
expect(response).to have_http_status :ok
|
||||
end
|
||||
|
||||
it 'returns NOT FOUND for draft answer' do
|
||||
get help_answer_path(locale_name, category, draft_answer)
|
||||
expect(response).to have_http_status :not_found
|
||||
end
|
||||
end
|
||||
|
||||
context 'when visitor is an editor' do
|
||||
before do
|
||||
published_answer && draft_answer
|
||||
authenticated_as(create(:admin), via: :browser)
|
||||
end
|
||||
|
||||
it 'returns OK for published answer' do
|
||||
get help_answer_path(locale_name, category, published_answer)
|
||||
expect(response).to have_http_status :ok
|
||||
end
|
||||
|
||||
it 'returns OK for draft answer' do
|
||||
get help_answer_path(locale_name, category, draft_answer)
|
||||
expect(response).to have_http_status :ok
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue