mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 01:58:12 +08:00
e72fd7ae4e
This refinement of previous fix moves the crawler blocking into anonymous cache This ensures we never poison the cache incorrectly when blocking crawlers
37 lines
1.1 KiB
Ruby
37 lines
1.1 KiB
Ruby
require 'rails_helper'
|
|
|
|
RSpec.describe ApplicationController do
|
|
describe '#redirect_to_login_if_required' do
|
|
let(:admin) { Fabricate(:admin) }
|
|
|
|
before do
|
|
admin # to skip welcome wizard at home page `/`
|
|
SiteSetting.login_required = true
|
|
end
|
|
|
|
it "should carry-forward authComplete param to login page redirect" do
|
|
get "/?authComplete=true"
|
|
expect(response).to redirect_to('/login?authComplete=true')
|
|
end
|
|
end
|
|
|
|
describe 'build_not_found_page' do
|
|
describe 'topic not found' do
|
|
it 'should return 404 and show Google search' do
|
|
get "/t/nope-nope/99999999"
|
|
expect(response.status).to eq(404)
|
|
expect(response.body).to include(I18n.t('page_not_found.search_google'))
|
|
end
|
|
|
|
it 'should not include Google search if login_required is enabled' do
|
|
SiteSetting.login_required = true
|
|
sign_in(Fabricate(:user))
|
|
get "/t/nope-nope/99999999"
|
|
expect(response.status).to eq(404)
|
|
expect(response.body).to_not include('google.com/search')
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|