diff options
-rw-r--r-- | config/routes.rb | 10 | ||||
-rw-r--r-- | test/integration/routing/repositories_test.rb | 62 |
2 files changed, 52 insertions, 20 deletions
diff --git a/config/routes.rb b/config/routes.rb index 94f978bdd..22c61acb8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -214,6 +214,9 @@ RedmineApp::Application.routes.draw do get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats' get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph' + get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))', + :to => 'repositories#changes' + get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision' get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision' post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue' @@ -228,13 +231,16 @@ RedmineApp::Application.routes.draw do get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', :controller => 'repositories', :constraints => { - :action => /(browse|show|entry|changes|annotate|diff)/, + :action => /(browse|show|entry|annotate|diff)/, :rev => /[a-z0-9\.\-_]+/ } get 'projects/:id/repository/statistics', :to => 'repositories#stats' get 'projects/:id/repository/graph', :to => 'repositories#graph' + get 'projects/:id/repository/changes(/*path(.:ext))', + :to => 'repositories#changes' + get 'projects/:id/repository/revisions', :to => 'repositories#revisions' get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision' get 'projects/:id/repository/revision', :to => 'repositories#revision' @@ -249,7 +255,7 @@ RedmineApp::Application.routes.draw do get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', :controller => 'repositories', :constraints => { - :action => /(browse|show|entry|changes|annotate|diff)/, + :action => /(browse|show|entry|annotate|diff)/, :rev => /[a-z0-9\.\-_]+/ } get 'projects/:id/repository/:repository_id/:format(/*path(.:ext))', :to => 'repositories#entry', :format => /raw/ diff --git a/test/integration/routing/repositories_test.rb b/test/integration/routing/repositories_test.rb index 0b0761ee6..f02791b9f 100644 --- a/test/integration/routing/repositories_test.rb +++ b/test/integration/routing/repositories_test.rb @@ -134,16 +134,29 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest ) assert_routing( { :method => 'get', - :path => "/projects/redmine/repository/revisions/2457/changes" }, - { :controller => 'repositories', :action => 'changes', :id => 'redmine', - :rev => '2457' } - ) - assert_routing( - { :method => 'get', - :path => "/projects/redmine/repository/revisions/2457/changes/#{@path_hash[:path]}" }, - { :controller => 'repositories', :action => 'changes', :id => 'redmine', - :path => @path_hash[:param] , :rev => '2457'} + :path => "/projects/redmine/repository/changes" }, + { :controller => 'repositories', :action => 'changes', :id => 'redmine' } ) + ['2457', 'master', 'slash/slash'].each do |rev| + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/changes" }, + { :controller => 'repositories', :action => 'changes', :id => 'redmine', + :rev => rev }, + {}, + { :rev => rev } + ) + end + ['2457', 'master', 'slash/slash'].each do |rev| + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" }, + { :controller => 'repositories', :action => 'changes', :id => 'redmine', + :path => @path_hash[:param], :rev => rev }, + {}, + { :rev => rev } + ) + end assert_routing( { :method => 'get', :path => "/projects/redmine/repository/revisions/2457/diff" }, @@ -215,16 +228,29 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest ) assert_routing( { :method => 'get', - :path => "/projects/redmine/repository/foo/revisions/2457/changes" }, - { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo', - :rev => '2457' } - ) - assert_routing( - { :method => 'get', - :path => "/projects/redmine/repository/foo/revisions/2457/changes/#{@path_hash[:path]}" }, - { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo', - :path => @path_hash[:param] , :rev => '2457'} + :path => "/projects/redmine/repository/foo/changes" }, + { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo' } ) + ['2457', 'master', 'slash/slash'].each do |rev| + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/foo/changes" }, + { :controller => 'repositories', :action => 'changes', :id => 'redmine', + :repository_id => 'foo', :rev => rev }, + {}, + { :rev => rev } + ) + end + ['2457', 'master', 'slash/slash'].each do |rev| + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" }, + { :controller => 'repositories', :action => 'changes', :id => 'redmine', + :repository_id => 'foo', :path => @path_hash[:param], :rev => rev }, + {}, + { :rev => rev } + ) + end assert_routing( { :method => 'get', :path => "/projects/redmine/repository/foo/revisions/2457/diff" }, |