Feature #37807 » 0002-Always-allow-access-to-robots.txt-for-Anonymous.patch
| app/controllers/welcome_controller.rb | ||
|---|---|---|
| 20 | 20 |
class WelcomeController < ApplicationController |
| 21 | 21 |
self.main_menu = false |
| 22 | 22 | |
| 23 |
skip_before_action :check_if_login_required, only: [:robots] |
|
| 24 | ||
| 23 | 25 |
def index |
| 24 | 26 |
@news = News.latest User.current |
| 25 | 27 |
end |
| test/integration/welcome_test.rb | ||
|---|---|---|
| 42 | 42 |
# closed projects are included in the list |
| 43 | 43 |
assert @response.body.match(%r{^Disallow: /projects/subproject1/issues\r?$})
|
| 44 | 44 |
end |
| 45 | ||
| 46 |
def test_robots_when_login_is_required |
|
| 47 |
with_settings :login_required => '1' do |
|
| 48 |
get '/robots.txt' |
|
| 49 |
assert_response :success |
|
| 50 |
assert_equal 'text/plain', @response.media_type |
|
| 51 |
end |
|
| 52 |
end |
|
| 45 | 53 |
end |