2015-10-11 17:41:23 +08:00
|
|
|
require 'rails_helper'
|
2013-02-11 08:02:57 +08:00
|
|
|
|
2017-08-31 12:06:56 +08:00
|
|
|
RSpec.describe RobotsTxtController do
|
|
|
|
describe '#index' do
|
2013-02-26 06:58:16 +08:00
|
|
|
it "returns index when indexing is allowed" do
|
2015-06-03 18:14:00 +08:00
|
|
|
SiteSetting.allow_index_in_robots_txt = true
|
2017-08-31 12:06:56 +08:00
|
|
|
get '/robots.txt'
|
|
|
|
|
|
|
|
expect(response.body).to include("Disallow: /u/")
|
2013-02-11 08:02:57 +08:00
|
|
|
end
|
|
|
|
|
2013-02-26 23:42:49 +08:00
|
|
|
it "returns noindex when indexing is disallowed" do
|
2015-06-03 18:14:00 +08:00
|
|
|
SiteSetting.allow_index_in_robots_txt = false
|
2017-08-31 12:06:56 +08:00
|
|
|
get '/robots.txt'
|
2013-02-26 00:42:20 +08:00
|
|
|
|
2017-08-31 12:06:56 +08:00
|
|
|
expect(response.body).to_not include("Disallow: /u/")
|
|
|
|
end
|
2013-02-11 08:02:57 +08:00
|
|
|
end
|
|
|
|
end
|