2013-02-11 08:02:57 +08:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe RobotsTxtController do
|
|
|
|
|
|
|
|
context '.index' do
|
2013-02-26 06:58:16 +08:00
|
|
|
|
|
|
|
it "returns index when indexing is allowed" do
|
2013-02-11 08:02:57 +08:00
|
|
|
SiteSetting.stubs(:allow_index_in_robots_txt).returns(true)
|
|
|
|
get :index
|
|
|
|
response.should render_template :index
|
|
|
|
end
|
|
|
|
|
2013-02-26 23:42:49 +08:00
|
|
|
it "returns noindex when indexing is disallowed" do
|
2013-02-11 08:02:57 +08:00
|
|
|
SiteSetting.stubs(:allow_index_in_robots_txt).returns(false)
|
|
|
|
get :index
|
|
|
|
response.should render_template :no_index
|
2013-02-26 00:42:20 +08:00
|
|
|
end
|
|
|
|
|
2013-02-26 23:42:49 +08:00
|
|
|
it "serves noindex when in private mode regardless of the configuration" do
|
2013-02-11 08:02:57 +08:00
|
|
|
SiteSetting.stubs(:allow_index_in_robots_txt).returns(true)
|
2013-03-02 01:45:25 +08:00
|
|
|
SiteSetting.stubs(:access_password).returns('adventure time!')
|
2013-02-11 08:02:57 +08:00
|
|
|
get :index
|
|
|
|
response.should render_template :no_index
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|