mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
added support for disabling indexing by google using SiteSetting.allow_index_in_robots_txt = false
This commit is contained in:
parent
8250586306
commit
c50a9e4d01
7 changed files with 54 additions and 3 deletions
26
spec/controllers/robots_txt_controller_spec.rb
Normal file
26
spec/controllers/robots_txt_controller_spec.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe RobotsTxtController do
|
||||
|
||||
context '.index' do
|
||||
it "returns noindex when indexing is disallowed" do
|
||||
SiteSetting.stubs(:allow_index_in_robots_txt).returns(true)
|
||||
get :index
|
||||
response.should render_template :index
|
||||
end
|
||||
|
||||
it "returns index when indexing is allowed" do
|
||||
SiteSetting.stubs(:allow_index_in_robots_txt).returns(false)
|
||||
get :index
|
||||
response.should render_template :no_index
|
||||
end
|
||||
|
||||
it "serves it regardless if a site is in private mode" do
|
||||
SiteSetting.stubs(:allow_index_in_robots_txt).returns(true)
|
||||
SiteSetting.stubs(:restrict_access).returns(true)
|
||||
get :index
|
||||
response.should render_template :no_index
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue