Feature #37807 » 0001-Render-all-visible-projects-in-robots.txt-including-.patch
| app/controllers/welcome_controller.rb | ||
|---|---|---|
|
end
|
||
|
def robots
|
||
|
@projects = Project.all_public.active
|
||
|
@projects = Project.visible(User.anonymous)
|
||
|
render :layout => false, :content_type => 'text/plain'
|
||
|
end
|
||
|
end
|
||
| test/integration/welcome_test.rb | ||
|---|---|---|
|
:projects, :enabled_modules, :members, :member_roles, :roles
|
||
|
def test_robots
|
||
|
Project.find(3).update_attribute :status, Project::STATUS_CLOSED
|
||
|
get '/robots.txt'
|
||
|
assert_response :success
|
||
|
assert_equal 'text/plain', @response.media_type
|
||
| ... | ... | |
|
assert @response.body.match(%r{^Disallow: /login\r?$})
|
||
|
assert @response.body.match(%r{^Disallow: /account/register\r?$})
|
||
|
assert @response.body.match(%r{^Disallow: /account/lost_password\r?$})
|
||
|
# closed projects are included in the list
|
||
|
assert @response.body.match(%r{^Disallow: /projects/subproject1/issues\r?$})
|
||
|
end
|
||
|
end
|
||