Follow up - 9e4fae - Fixes #3164 - Robots.txt should allow indexing Knowledge Base on custom URLs
This commit is contained in:
parent
11c023e9be
commit
b9d170f1e4
1 changed files with 9 additions and 11 deletions
|
@ -3,6 +3,11 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe 'RobotsTxt', type: :request do
|
RSpec.describe 'RobotsTxt', type: :request do
|
||||||
|
shared_examples 'returns default robot instructions' do
|
||||||
|
it 'returns default robot instructions' do
|
||||||
|
expect(response.body).to match(%r{^Allow: /help/$}).and match(%r{^Disallow: /$})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'when no Knowledge Base exists' do
|
context 'when no Knowledge Base exists' do
|
||||||
|
|
||||||
|
@ -15,12 +20,10 @@ RSpec.describe 'RobotsTxt', type: :request do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns text' do
|
it 'returns text' do
|
||||||
expect(response.content_type).to eq('text/plain')
|
expect(response.content_type).to start_with('text/plain')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns robot instructions' do
|
include_examples 'returns default robot instructions'
|
||||||
expect(response.body).to include('Allow:').and(include('Disallow:'))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when Knowledge Base exists' do
|
context 'when Knowledge Base exists' do
|
||||||
|
@ -33,9 +36,7 @@ RSpec.describe 'RobotsTxt', type: :request do
|
||||||
get '/robots.txt', headers: { SERVER_NAME: server_name }
|
get '/robots.txt', headers: { SERVER_NAME: server_name }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns robot instructions' do
|
include_examples 'returns default robot instructions'
|
||||||
expect(response.body).to include('Allow:').and(include('Disallow:'))
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when custom path is configured' do
|
context 'when custom path is configured' do
|
||||||
let(:custom_address) { '/knowledge_base' }
|
let(:custom_address) { '/knowledge_base' }
|
||||||
|
@ -49,10 +50,7 @@ RSpec.describe 'RobotsTxt', type: :request do
|
||||||
let(:custom_address) { 'kb.com/knowledge_base' }
|
let(:custom_address) { 'kb.com/knowledge_base' }
|
||||||
|
|
||||||
context 'when requesting main domain' do
|
context 'when requesting main domain' do
|
||||||
|
include_examples 'returns default robot instructions'
|
||||||
it 'returns default rules' do
|
|
||||||
expect(response.body).to include('Allow:').and(include('Disallow:'))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when requesting KB domain' do
|
context 'when requesting KB domain' do
|
||||||
|
|
Loading…
Reference in a new issue