2015-10-11 10:41:23 +01:00
|
|
|
require 'rails_helper'
|
2013-02-11 11:02:57 +11:00
|
|
|
|
2017-08-31 12:06:56 +08:00
|
|
|
RSpec.describe RobotsTxtController do
|
|
|
|
describe '#index' do
|
2013-02-25 23:58:16 +01:00
|
|
|
it "returns index when indexing is allowed" do
|
2015-06-03 15:44:00 +05:30
|
|
|
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 11:02:57 +11:00
|
|
|
end
|
|
|
|
|
2013-02-26 10:42:49 -05:00
|
|
|
it "returns noindex when indexing is disallowed" do
|
2015-06-03 15:44:00 +05:30
|
|
|
SiteSetting.allow_index_in_robots_txt = false
|
2017-08-31 12:06:56 +08:00
|
|
|
get '/robots.txt'
|
2013-02-25 19:42:20 +03:00
|
|
|
|
2017-08-31 12:06:56 +08:00
|
|
|
expect(response.body).to_not include("Disallow: /u/")
|
|
|
|
end
|
2013-02-11 11:02:57 +11:00
|
|
|
end
|
|
|
|
end
|