Defect #40208 » fix_robots_route.patch
| config/routes.rb | ||
|---|---|---|
|
match 'uploads', :to => 'attachments#upload', :via => :post
|
||
|
get 'robots', :to => 'welcome#robots'
|
||
|
get 'robots', :to => 'welcome#robots', :defaults => { format: 'txt' }
|
||
|
Redmine::Plugin.directory.glob("*/config/routes.rb").sort.each do |plugin_routes_path|
|
||
|
instance_eval(plugin_routes_path.read, plugin_routes_path.to_s)
|
||
| test/integration/routing/welcome_test.rb | ||
|---|---|---|
|
class RoutingWelcomeTest < Redmine::RoutingTest
|
||
|
def test_welcome
|
||
|
should_route 'GET /' => 'welcome#index'
|
||
|
should_route 'GET /robots.txt' => 'welcome#robots', :format => 'txt'
|
||
|
should_route 'GET /robots' => 'welcome#robots', :format => 'txt'
|
||
|
end
|
||
|
end
|
||
| test/integration/welcome_test.rb | ||
|---|---|---|
|
assert @response.body.match(%r{^Disallow: /projects/subproject1/issues\r?$})
|
||
|
end
|
||
|
def test_robots_when_no_format_is_given
|
||
|
get '/robots'
|
||
|
assert_response :success
|
||
|
assert_equal 'text/plain', @response.media_type
|
||
|
end
|
||
|
def test_robots_when_login_is_required
|
||
|
with_settings :login_required => '1' do
|
||
|
get '/robots.txt'
|
||