Add tests for X-Robots-Tag

This commit is contained in:
Kane York 2015-06-22 16:02:45 -07:00
parent 2f0bd6294c
commit 470d9418fd
1 changed files with 15 additions and 0 deletions

View File

@ -1018,4 +1018,19 @@ describe TopicsController do
expect(json["banner_count"]).to eq(1)
end
end
describe "x-robots-tag" do
it "is included for unlisted topics" do
topic = Fabricate(:topic, visible: false)
get :show, topic_id: topic.id, slug: topic.slug
expect(response.headers['X-Robots-Tag']).to eq('noindex')
end
it "is not included for normal topics" do
topic = Fabricate(:topic, visible: true)
get :show, topic_id: topic.id, slug: topic.slug
expect(response.headers['X-Robots-Tag']).to eq(nil)
end
end
end