@@ -1,393 +1,395 | |||||
1 | ActionController::Routing::Routes.draw do |map| |
|
1 | ActionController::Routing::Routes.draw do |map| | |
2 | # Add your own custom routes here. |
|
2 | # Add your own custom routes here. | |
3 | # The priority is based upon order of creation: first created -> highest priority. |
|
3 | # The priority is based upon order of creation: first created -> highest priority. | |
4 |
|
4 | |||
5 | # Here's a sample route: |
|
5 | # Here's a sample route: | |
6 | # map.connect 'products/:id', :controller => 'catalog', :action => 'view' |
|
6 | # map.connect 'products/:id', :controller => 'catalog', :action => 'view' | |
7 | # Keep in mind you can assign values other than :controller and :action |
|
7 | # Keep in mind you can assign values other than :controller and :action | |
8 |
|
8 | |||
9 | map.home '', :controller => 'welcome', :conditions => {:method => :get} |
|
9 | map.home '', :controller => 'welcome', :conditions => {:method => :get} | |
10 |
|
10 | |||
11 | map.signin 'login', :controller => 'account', :action => 'login', |
|
11 | map.signin 'login', :controller => 'account', :action => 'login', | |
12 | :conditions => {:method => [:get, :post]} |
|
12 | :conditions => {:method => [:get, :post]} | |
13 | map.signout 'logout', :controller => 'account', :action => 'logout', |
|
13 | map.signout 'logout', :controller => 'account', :action => 'logout', | |
14 | :conditions => {:method => :get} |
|
14 | :conditions => {:method => :get} | |
15 | map.connect 'account/register', :controller => 'account', :action => 'register', |
|
15 | map.connect 'account/register', :controller => 'account', :action => 'register', | |
16 | :conditions => {:method => [:get, :post]} |
|
16 | :conditions => {:method => [:get, :post]} | |
17 | map.connect 'account/lost_password', :controller => 'account', :action => 'lost_password', |
|
17 | map.connect 'account/lost_password', :controller => 'account', :action => 'lost_password', | |
18 | :conditions => {:method => [:get, :post]} |
|
18 | :conditions => {:method => [:get, :post]} | |
19 | map.connect 'account/activate', :controller => 'account', :action => 'activate', |
|
19 | map.connect 'account/activate', :controller => 'account', :action => 'activate', | |
20 | :conditions => {:method => :get} |
|
20 | :conditions => {:method => :get} | |
21 |
|
21 | |||
22 | map.connect 'projects/:id/wiki', :controller => 'wikis', |
|
22 | map.connect 'projects/:id/wiki', :controller => 'wikis', | |
23 | :action => 'edit', :conditions => {:method => :post} |
|
23 | :action => 'edit', :conditions => {:method => :post} | |
24 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', |
|
24 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', | |
25 | :action => 'destroy', :conditions => {:method => [:get, :post]} |
|
25 | :action => 'destroy', :conditions => {:method => [:get, :post]} | |
26 |
|
26 | |||
27 | map.with_options :controller => 'messages' do |messages_routes| |
|
27 | map.with_options :controller => 'messages' do |messages_routes| | |
28 | messages_routes.with_options :conditions => {:method => :get} do |messages_views| |
|
28 | messages_routes.with_options :conditions => {:method => :get} do |messages_views| | |
29 | messages_views.connect 'boards/:board_id/topics/new', :action => 'new' |
|
29 | messages_views.connect 'boards/:board_id/topics/new', :action => 'new' | |
30 | messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' |
|
30 | messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' | |
31 | messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' |
|
31 | messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' | |
32 | end |
|
32 | end | |
33 | messages_routes.with_options :conditions => {:method => :post} do |messages_actions| |
|
33 | messages_routes.with_options :conditions => {:method => :post} do |messages_actions| | |
34 | messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' |
|
34 | messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' | |
35 | messages_actions.connect 'boards/:board_id/topics/preview', :action => 'preview' |
|
35 | messages_actions.connect 'boards/:board_id/topics/preview', :action => 'preview' | |
36 | messages_actions.connect 'boards/:board_id/topics/quote/:id', :action => 'quote' |
|
36 | messages_actions.connect 'boards/:board_id/topics/quote/:id', :action => 'quote' | |
37 | messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' |
|
37 | messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' | |
38 | messages_actions.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' |
|
38 | messages_actions.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' | |
39 | messages_actions.connect 'boards/:board_id/topics/:id/destroy', :action => 'destroy' |
|
39 | messages_actions.connect 'boards/:board_id/topics/:id/destroy', :action => 'destroy' | |
40 | end |
|
40 | end | |
41 | end |
|
41 | end | |
42 |
|
42 | |||
43 | # Misc issue routes. TODO: move into resources |
|
43 | # Misc issue routes. TODO: move into resources | |
44 | map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', |
|
44 | map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', | |
45 | :action => 'issues', :conditions => { :method => :get } |
|
45 | :action => 'issues', :conditions => { :method => :get } | |
46 | # TODO: would look nicer as /issues/:id/preview |
|
46 | # TODO: would look nicer as /issues/:id/preview | |
47 | map.preview_new_issue '/issues/preview/new/:project_id', :controller => 'previews', |
|
47 | map.preview_new_issue '/issues/preview/new/:project_id', :controller => 'previews', | |
48 | :action => 'issue' |
|
48 | :action => 'issue' | |
49 | map.preview_edit_issue '/issues/preview/edit/:id', :controller => 'previews', |
|
49 | map.preview_edit_issue '/issues/preview/edit/:id', :controller => 'previews', | |
50 | :action => 'issue' |
|
50 | :action => 'issue' | |
51 | map.issues_context_menu '/issues/context_menu', |
|
51 | map.issues_context_menu '/issues/context_menu', | |
52 | :controller => 'context_menus', :action => 'issues' |
|
52 | :controller => 'context_menus', :action => 'issues' | |
53 |
|
53 | |||
54 | map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' |
|
54 | map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' | |
55 | map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', |
|
55 | map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', | |
56 | :id => /\d+/, :conditions => { :method => :post } |
|
56 | :id => /\d+/, :conditions => { :method => :post } | |
57 |
|
57 | |||
58 | map.connect '/journals/diff/:id', :controller => 'journals', :action => 'diff', |
|
58 | map.connect '/journals/diff/:id', :controller => 'journals', :action => 'diff', | |
59 | :id => /\d+/, :conditions => { :method => :get } |
|
59 | :id => /\d+/, :conditions => { :method => :get } | |
60 | map.connect '/journals/edit/:id', :controller => 'journals', :action => 'edit', |
|
60 | map.connect '/journals/edit/:id', :controller => 'journals', :action => 'edit', | |
61 | :id => /\d+/, :conditions => { :method => [:get, :post] } |
|
61 | :id => /\d+/, :conditions => { :method => [:get, :post] } | |
62 |
|
62 | |||
63 | map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes| |
|
63 | map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes| | |
64 | gantts_routes.connect '/projects/:project_id/issues/gantt' |
|
64 | gantts_routes.connect '/projects/:project_id/issues/gantt' | |
65 | gantts_routes.connect '/projects/:project_id/issues/gantt.:format' |
|
65 | gantts_routes.connect '/projects/:project_id/issues/gantt.:format' | |
66 | gantts_routes.connect '/issues/gantt.:format' |
|
66 | gantts_routes.connect '/issues/gantt.:format' | |
67 | end |
|
67 | end | |
68 |
|
68 | |||
69 | map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes| |
|
69 | map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes| | |
70 | calendars_routes.connect '/projects/:project_id/issues/calendar' |
|
70 | calendars_routes.connect '/projects/:project_id/issues/calendar' | |
71 | calendars_routes.connect '/issues/calendar' |
|
71 | calendars_routes.connect '/issues/calendar' | |
72 | end |
|
72 | end | |
73 |
|
73 | |||
74 | map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports| |
|
74 | map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports| | |
75 | reports.connect 'projects/:id/issues/report', :action => 'issue_report' |
|
75 | reports.connect 'projects/:id/issues/report', :action => 'issue_report' | |
76 | reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details' |
|
76 | reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details' | |
77 | end |
|
77 | end | |
78 |
|
78 | |||
79 | map.connect 'my/account', :controller => 'my', :action => 'account', |
|
79 | map.connect 'my/account', :controller => 'my', :action => 'account', | |
80 | :conditions => {:method => [:get, :post]} |
|
80 | :conditions => {:method => [:get, :post]} | |
81 | map.connect 'my/page', :controller => 'my', :action => 'page', |
|
81 | map.connect 'my/page', :controller => 'my', :action => 'page', | |
82 | :conditions => {:method => :get} |
|
82 | :conditions => {:method => :get} | |
83 | # Redirects to my/page |
|
83 | # Redirects to my/page | |
84 | map.connect 'my', :controller => 'my', :action => 'index', |
|
84 | map.connect 'my', :controller => 'my', :action => 'index', | |
85 | :conditions => {:method => :get} |
|
85 | :conditions => {:method => :get} | |
86 | map.connect 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', |
|
86 | map.connect 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', | |
87 | :conditions => {:method => :post} |
|
87 | :conditions => {:method => :post} | |
88 | map.connect 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', |
|
88 | map.connect 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', | |
89 | :conditions => {:method => :post} |
|
89 | :conditions => {:method => :post} | |
90 | map.connect 'my/password', :controller => 'my', :action => 'password', |
|
90 | map.connect 'my/password', :controller => 'my', :action => 'password', | |
91 | :conditions => {:method => [:get, :post]} |
|
91 | :conditions => {:method => [:get, :post]} | |
92 | map.connect 'my/page_layout', :controller => 'my', :action => 'page_layout', |
|
92 | map.connect 'my/page_layout', :controller => 'my', :action => 'page_layout', | |
93 | :conditions => {:method => :get} |
|
93 | :conditions => {:method => :get} | |
94 | map.connect 'my/add_block', :controller => 'my', :action => 'add_block', |
|
94 | map.connect 'my/add_block', :controller => 'my', :action => 'add_block', | |
95 | :conditions => {:method => :post} |
|
95 | :conditions => {:method => :post} | |
96 | map.connect 'my/remove_block', :controller => 'my', :action => 'remove_block', |
|
96 | map.connect 'my/remove_block', :controller => 'my', :action => 'remove_block', | |
97 | :conditions => {:method => :post} |
|
97 | :conditions => {:method => :post} | |
98 | map.connect 'my/order_blocks', :controller => 'my', :action => 'order_blocks', |
|
98 | map.connect 'my/order_blocks', :controller => 'my', :action => 'order_blocks', | |
99 | :conditions => {:method => :post} |
|
99 | :conditions => {:method => :post} | |
100 |
|
100 | |||
101 | map.with_options :controller => 'users' do |users| |
|
101 | map.with_options :controller => 'users' do |users| | |
102 | users.user_membership 'users/:id/memberships/:membership_id', |
|
102 | users.user_membership 'users/:id/memberships/:membership_id', | |
103 | :action => 'edit_membership', |
|
103 | :action => 'edit_membership', | |
104 | :conditions => {:method => :put} |
|
104 | :conditions => {:method => :put} | |
105 | users.connect 'users/:id/memberships/:membership_id', |
|
105 | users.connect 'users/:id/memberships/:membership_id', | |
106 | :action => 'destroy_membership', |
|
106 | :action => 'destroy_membership', | |
107 | :conditions => {:method => :delete} |
|
107 | :conditions => {:method => :delete} | |
108 | users.user_memberships 'users/:id/memberships', |
|
108 | users.user_memberships 'users/:id/memberships', | |
109 | :action => 'edit_membership', |
|
109 | :action => 'edit_membership', | |
110 | :conditions => {:method => :post} |
|
110 | :conditions => {:method => :post} | |
111 | end |
|
111 | end | |
112 | map.resources :users |
|
112 | map.resources :users | |
113 |
|
113 | |||
114 | # For nice "roadmap" in the url for the index action |
|
114 | # For nice "roadmap" in the url for the index action | |
115 | map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index' |
|
115 | map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index' | |
116 |
|
116 | |||
117 | map.preview_news '/news/preview', :controller => 'previews', :action => 'news' |
|
117 | map.preview_news '/news/preview', :controller => 'previews', :action => 'news' | |
118 | map.connect 'news/:id/comments', :controller => 'comments', |
|
118 | map.connect 'news/:id/comments', :controller => 'comments', | |
119 | :action => 'create', :conditions => {:method => :post} |
|
119 | :action => 'create', :conditions => {:method => :post} | |
120 | map.connect 'news/:id/comments/:comment_id', :controller => 'comments', |
|
120 | map.connect 'news/:id/comments/:comment_id', :controller => 'comments', | |
121 | :action => 'destroy', :conditions => {:method => :delete} |
|
121 | :action => 'destroy', :conditions => {:method => :delete} | |
122 |
|
122 | |||
123 | map.connect 'watchers/new', :controller=> 'watchers', :action => 'new', |
|
123 | map.connect 'watchers/new', :controller=> 'watchers', :action => 'new', | |
124 | :conditions => {:method => :get} |
|
124 | :conditions => {:method => :get} | |
125 | map.connect 'watchers', :controller=> 'watchers', :action => 'create', |
|
125 | map.connect 'watchers', :controller=> 'watchers', :action => 'create', | |
126 | :conditions => {:method => :post} |
|
126 | :conditions => {:method => :post} | |
127 | map.connect 'watchers/append', :controller=> 'watchers', :action => 'append', |
|
127 | map.connect 'watchers/append', :controller=> 'watchers', :action => 'append', | |
128 | :conditions => {:method => :post} |
|
128 | :conditions => {:method => :post} | |
129 | map.connect 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', |
|
129 | map.connect 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', | |
130 | :conditions => {:method => :post} |
|
130 | :conditions => {:method => :post} | |
131 | map.connect 'watchers/watch', :controller=> 'watchers', :action => 'watch', |
|
131 | map.connect 'watchers/watch', :controller=> 'watchers', :action => 'watch', | |
132 | :conditions => {:method => :post} |
|
132 | :conditions => {:method => :post} | |
133 | map.connect 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', |
|
133 | map.connect 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', | |
134 | :conditions => {:method => :post} |
|
134 | :conditions => {:method => :post} | |
135 | map.connect 'watchers/autocomplete_for_user', :controller=> 'watchers', :action => 'autocomplete_for_user', |
|
135 | map.connect 'watchers/autocomplete_for_user', :controller=> 'watchers', :action => 'autocomplete_for_user', | |
136 | :conditions => {:method => :get} |
|
136 | :conditions => {:method => :get} | |
137 |
|
137 | |||
138 | # TODO: port to be part of the resources route(s) |
|
138 | # TODO: port to be part of the resources route(s) | |
139 | map.with_options :conditions => {:method => :get} do |project_views| |
|
139 | map.with_options :conditions => {:method => :get} do |project_views| | |
140 | project_views.connect 'projects/:id/settings/:tab', |
|
140 | project_views.connect 'projects/:id/settings/:tab', | |
141 | :controller => 'projects', :action => 'settings' |
|
141 | :controller => 'projects', :action => 'settings' | |
142 | project_views.connect 'projects/:project_id/issues/:copy_from/copy', |
|
142 | project_views.connect 'projects/:project_id/issues/:copy_from/copy', | |
143 | :controller => 'issues', :action => 'new' |
|
143 | :controller => 'issues', :action => 'new' | |
144 | end |
|
144 | end | |
145 |
|
145 | |||
146 | map.resources :projects, :member => { |
|
146 | map.resources :projects, :member => { | |
147 | :copy => [:get, :post], |
|
147 | :copy => [:get, :post], | |
148 | :settings => :get, |
|
148 | :settings => :get, | |
149 | :modules => :post, |
|
149 | :modules => :post, | |
150 | :archive => :post, |
|
150 | :archive => :post, | |
151 | :unarchive => :post |
|
151 | :unarchive => :post | |
152 | } do |project| |
|
152 | } do |project| | |
153 | project.resource :enumerations, :controller => 'project_enumerations', |
|
153 | project.resource :enumerations, :controller => 'project_enumerations', | |
154 | :only => [:update, :destroy] |
|
154 | :only => [:update, :destroy] | |
155 | # issue form update |
|
155 | # issue form update | |
156 | project.issue_form 'issues/new', :controller => 'issues', |
|
156 | project.issue_form 'issues/new', :controller => 'issues', | |
157 | :action => 'new', :conditions => {:method => [:post, :put]} |
|
157 | :action => 'new', :conditions => {:method => [:post, :put]} | |
158 | project.resources :issues, :only => [:index, :new, :create] do |issues| |
|
158 | project.resources :issues, :only => [:index, :new, :create] do |issues| | |
159 | issues.resources :time_entries, :controller => 'timelog', |
|
159 | issues.resources :time_entries, :controller => 'timelog', | |
160 | :collection => {:report => :get} |
|
160 | :collection => {:report => :get} | |
161 | end |
|
161 | end | |
162 |
|
162 | |||
163 | project.resources :files, :only => [:index, :new, :create] |
|
163 | project.resources :files, :only => [:index, :new, :create] | |
164 | project.resources :versions, :shallow => true, |
|
164 | project.resources :versions, :shallow => true, | |
165 | :collection => {:close_completed => :put}, |
|
165 | :collection => {:close_completed => :put}, | |
166 | :member => {:status_by => :post} |
|
166 | :member => {:status_by => :post} | |
167 | project.resources :news, :shallow => true |
|
167 | project.resources :news, :shallow => true | |
168 | project.resources :time_entries, :controller => 'timelog', |
|
168 | project.resources :time_entries, :controller => 'timelog', | |
169 | :collection => {:report => :get} |
|
169 | :collection => {:report => :get} | |
170 | project.resources :queries, :only => [:new, :create] |
|
170 | project.resources :queries, :only => [:new, :create] | |
171 | project.resources :issue_categories, :shallow => true |
|
171 | project.resources :issue_categories, :shallow => true | |
172 | project.resources :documents, :shallow => true, :member => {:add_attachment => :post} |
|
172 | project.resources :documents, :shallow => true, :member => {:add_attachment => :post} | |
173 | project.resources :boards |
|
173 | project.resources :boards | |
174 | project.resources :repositories, :shallow => true, :except => [:index, :show], |
|
174 | project.resources :repositories, :shallow => true, :except => [:index, :show], | |
175 | :member => {:committers => [:get, :post]} |
|
175 | :member => {:committers => [:get, :post]} | |
176 | project.resources :memberships, :shallow => true, :controller => 'members', |
|
176 | project.resources :memberships, :shallow => true, :controller => 'members', | |
177 | :only => [:index, :show, :create, :update, :destroy], |
|
177 | :only => [:index, :show, :create, :update, :destroy], | |
178 | :collection => {:autocomplete => :get} |
|
178 | :collection => {:autocomplete => :get} | |
179 |
|
179 | |||
180 | project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get} |
|
180 | project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get} | |
181 | project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get} |
|
181 | project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get} | |
182 | project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil |
|
182 | project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil | |
183 | project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff' |
|
183 | project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff' | |
184 | project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate' |
|
184 | project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate' | |
185 | project.resources :wiki, :except => [:new, :create], :member => { |
|
185 | project.resources :wiki, :except => [:new, :create], :member => { | |
186 | :rename => [:get, :post], |
|
186 | :rename => [:get, :post], | |
187 | :history => :get, |
|
187 | :history => :get, | |
188 | :preview => :any, |
|
188 | :preview => :any, | |
189 | :protect => :post, |
|
189 | :protect => :post, | |
190 | :add_attachment => :post |
|
190 | :add_attachment => :post | |
191 | }, :collection => { |
|
191 | }, :collection => { | |
192 | :export => :get, |
|
192 | :export => :get, | |
193 | :date_index => :get |
|
193 | :date_index => :get | |
194 | } |
|
194 | } | |
195 | end |
|
195 | end | |
196 |
|
196 | |||
197 | map.connect 'news', :controller => 'news', :action => 'index' |
|
197 | map.connect 'news', :controller => 'news', :action => 'index' | |
198 | map.connect 'news.:format', :controller => 'news', :action => 'index' |
|
198 | map.connect 'news.:format', :controller => 'news', :action => 'index' | |
199 |
|
199 | |||
200 | map.resources :queries, :except => [:show] |
|
200 | map.resources :queries, :except => [:show] | |
201 | map.resources :issues, |
|
201 | map.resources :issues, | |
202 | :collection => {:bulk_edit => [:get, :post], :bulk_update => :post} do |issues| |
|
202 | :collection => {:bulk_edit => [:get, :post], :bulk_update => :post} do |issues| | |
203 | issues.resources :time_entries, :controller => 'timelog', |
|
203 | issues.resources :time_entries, :controller => 'timelog', | |
204 | :collection => {:report => :get} |
|
204 | :collection => {:report => :get} | |
205 | issues.resources :relations, :shallow => true, |
|
205 | issues.resources :relations, :shallow => true, | |
206 | :controller => 'issue_relations', |
|
206 | :controller => 'issue_relations', | |
207 | :only => [:index, :show, :create, :destroy] |
|
207 | :only => [:index, :show, :create, :destroy] | |
208 | end |
|
208 | end | |
209 | # Bulk deletion |
|
209 | # Bulk deletion | |
210 | map.connect '/issues', :controller => 'issues', :action => 'destroy', |
|
210 | map.connect '/issues', :controller => 'issues', :action => 'destroy', | |
211 | :conditions => {:method => :delete} |
|
211 | :conditions => {:method => :delete} | |
212 |
|
212 | |||
213 | map.connect '/time_entries/destroy', |
|
213 | map.connect '/time_entries/destroy', | |
214 | :controller => 'timelog', :action => 'destroy', |
|
214 | :controller => 'timelog', :action => 'destroy', | |
215 | :conditions => { :method => :delete } |
|
215 | :conditions => { :method => :delete } | |
216 | map.time_entries_context_menu '/time_entries/context_menu', |
|
216 | map.time_entries_context_menu '/time_entries/context_menu', | |
217 | :controller => 'context_menus', :action => 'time_entries' |
|
217 | :controller => 'context_menus', :action => 'time_entries' | |
218 |
|
218 | |||
219 | map.resources :time_entries, :controller => 'timelog', |
|
219 | map.resources :time_entries, :controller => 'timelog', | |
220 | :collection => {:report => :get, :bulk_edit => :get, :bulk_update => :post} |
|
220 | :collection => {:report => :get, :bulk_edit => :get, :bulk_update => :post} | |
221 |
|
221 | |||
222 | map.with_options :controller => 'activities', :action => 'index', |
|
222 | map.with_options :controller => 'activities', :action => 'index', | |
223 | :conditions => {:method => :get} do |activity| |
|
223 | :conditions => {:method => :get} do |activity| | |
224 | activity.connect 'projects/:id/activity' |
|
224 | activity.connect 'projects/:id/activity' | |
225 | activity.connect 'projects/:id/activity.:format' |
|
225 | activity.connect 'projects/:id/activity.:format' | |
226 | activity.connect 'activity', :id => nil |
|
226 | activity.connect 'activity', :id => nil | |
227 | activity.connect 'activity.:format', :id => nil |
|
227 | activity.connect 'activity.:format', :id => nil | |
228 | end |
|
228 | end | |
229 |
|
229 | |||
230 | map.with_options :controller => 'repositories' do |repositories| |
|
230 | map.with_options :controller => 'repositories' do |repositories| | |
231 | repositories.with_options :conditions => {:method => :get} do |repository_views| |
|
231 | repositories.with_options :conditions => {:method => :get} do |repository_views| | |
232 | repository_views.connect 'projects/:id/repository', |
|
232 | repository_views.connect 'projects/:id/repository', | |
233 | :action => 'show' |
|
233 | :action => 'show' | |
234 |
|
234 | |||
235 | repository_views.connect 'projects/:id/repository/:repository_id/statistics', |
|
235 | repository_views.connect 'projects/:id/repository/:repository_id/statistics', | |
236 | :action => 'stats' |
|
236 | :action => 'stats' | |
237 | repository_views.connect 'projects/:id/repository/:repository_id/graph', |
|
237 | repository_views.connect 'projects/:id/repository/:repository_id/graph', | |
238 | :action => 'graph' |
|
238 | :action => 'graph' | |
239 |
|
239 | |||
240 | repository_views.connect 'projects/:id/repository/statistics', |
|
240 | repository_views.connect 'projects/:id/repository/statistics', | |
241 | :action => 'stats' |
|
241 | :action => 'stats' | |
242 | repository_views.connect 'projects/:id/repository/graph', |
|
242 | repository_views.connect 'projects/:id/repository/graph', | |
243 | :action => 'graph' |
|
243 | :action => 'graph' | |
244 |
|
244 | |||
245 | repository_views.connect 'projects/:id/repository/:repository_id/revisions', |
|
245 | repository_views.connect 'projects/:id/repository/:repository_id/revisions', | |
246 | :action => 'revisions' |
|
246 | :action => 'revisions' | |
247 | repository_views.connect 'projects/:id/repository/:repository_id/revisions.:format', |
|
247 | repository_views.connect 'projects/:id/repository/:repository_id/revisions.:format', | |
248 | :action => 'revisions' |
|
248 | :action => 'revisions' | |
249 | repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev', |
|
249 | repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev', | |
250 | :action => 'revision' |
|
250 | :action => 'revision' | |
251 | repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/issues', |
|
251 | repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/issues', | |
252 | :action => 'add_related_issue', :conditions => {:method => :post} |
|
252 | :action => 'add_related_issue', :conditions => {:method => :post} | |
253 | repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', |
|
253 | repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', | |
254 | :action => 'remove_related_issue', :conditions => {:method => :delete} |
|
254 | :action => 'remove_related_issue', :conditions => {:method => :delete} | |
255 | repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/diff', |
|
255 | repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/diff', | |
256 | :action => 'diff' |
|
256 | :action => 'diff' | |
257 | repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/diff.:format', |
|
257 | repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/diff.:format', | |
258 | :action => 'diff' |
|
258 | :action => 'diff' | |
259 | repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/raw/*path', |
|
259 | repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/raw/*path', | |
260 | :action => 'entry', :format => 'raw' |
|
260 | :action => 'entry', :format => 'raw' | |
261 | repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/:action/*path', |
|
261 | repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/:action/*path', | |
262 | :requirements => { |
|
262 | :requirements => { | |
263 | :action => /(browse|show|entry|changes|annotate|diff)/, |
|
263 | :action => /(browse|show|entry|changes|annotate|diff)/, | |
264 | :rev => /[a-z0-9\.\-_]+/ |
|
264 | :rev => /[a-z0-9\.\-_]+/ | |
265 | } |
|
265 | } | |
266 | repository_views.connect 'projects/:id/repository/:repository_id/raw/*path', |
|
266 | repository_views.connect 'projects/:id/repository/:repository_id/raw/*path', | |
267 | :action => 'entry', :format => 'raw' |
|
267 | :action => 'entry', :format => 'raw' | |
268 | repository_views.connect 'projects/:id/repository/:repository_id/:action/*path', |
|
268 | repository_views.connect 'projects/:id/repository/:repository_id/:action/*path', | |
269 | :requirements => { :action => /(browse|entry|changes|annotate|diff)/ } |
|
269 | :requirements => { :action => /(browse|entry|changes|annotate|diff)/ } | |
270 | repository_views.connect 'projects/:id/repository/:repository_id/show/*path', |
|
270 | repository_views.connect 'projects/:id/repository/:repository_id/show/*path', | |
271 | :requirements => { :path => /.+/ } |
|
271 | :requirements => { :path => /.+/ } | |
272 |
|
272 | |||
|
273 | repository_views.connect 'projects/:id/repository/:repository_id/revision', | |||
|
274 | :action => 'revision' | |||
|
275 | ||||
273 | repository_views.connect 'projects/:id/repository/revisions', |
|
276 | repository_views.connect 'projects/:id/repository/revisions', | |
274 | :action => 'revisions' |
|
277 | :action => 'revisions' | |
275 | repository_views.connect 'projects/:id/repository/revisions.:format', |
|
278 | repository_views.connect 'projects/:id/repository/revisions.:format', | |
276 | :action => 'revisions' |
|
279 | :action => 'revisions' | |
277 | repository_views.connect 'projects/:id/repository/revisions/:rev', |
|
280 | repository_views.connect 'projects/:id/repository/revisions/:rev', | |
278 | :action => 'revision' |
|
281 | :action => 'revision' | |
279 | repository_views.connect 'projects/:id/repository/revisions/:rev/issues', |
|
282 | repository_views.connect 'projects/:id/repository/revisions/:rev/issues', | |
280 | :action => 'add_related_issue', :conditions => {:method => :post} |
|
283 | :action => 'add_related_issue', :conditions => {:method => :post} | |
281 | repository_views.connect 'projects/:id/repository/revisions/:rev/issues/:issue_id', |
|
284 | repository_views.connect 'projects/:id/repository/revisions/:rev/issues/:issue_id', | |
282 | :action => 'remove_related_issue', :conditions => {:method => :delete} |
|
285 | :action => 'remove_related_issue', :conditions => {:method => :delete} | |
283 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', |
|
286 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', | |
284 | :action => 'diff' |
|
287 | :action => 'diff' | |
285 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', |
|
288 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', | |
286 | :action => 'diff' |
|
289 | :action => 'diff' | |
287 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', |
|
290 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', | |
288 | :action => 'entry', :format => 'raw' |
|
291 | :action => 'entry', :format => 'raw' | |
289 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', |
|
292 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', | |
290 | :requirements => { |
|
293 | :requirements => { | |
291 | :action => /(browse|show|entry|changes|annotate|diff)/, |
|
294 | :action => /(browse|show|entry|changes|annotate|diff)/, | |
292 | :rev => /[a-z0-9\.\-_]+/ |
|
295 | :rev => /[a-z0-9\.\-_]+/ | |
293 | } |
|
296 | } | |
294 | repository_views.connect 'projects/:id/repository/raw/*path', |
|
297 | repository_views.connect 'projects/:id/repository/raw/*path', | |
295 | :action => 'entry', :format => 'raw' |
|
298 | :action => 'entry', :format => 'raw' | |
296 | repository_views.connect 'projects/:id/repository/:action/*path', |
|
299 | repository_views.connect 'projects/:id/repository/:action/*path', | |
297 | :requirements => { :action => /(browse|show|entry|changes|annotate|diff)/ } |
|
300 | :requirements => { :action => /(browse|show|entry|changes|annotate|diff)/ } | |
298 |
|
301 | |||
|
302 | repository_views.connect 'projects/:id/repository/revision', | |||
|
303 | :action => 'revision' | |||
|
304 | ||||
299 | repository_views.connect 'projects/:id/repository/:repository_id', |
|
305 | repository_views.connect 'projects/:id/repository/:repository_id', | |
300 | :action => 'show' |
|
306 | :action => 'show' | |
301 | end |
|
307 | end | |
302 |
|
||||
303 | repositories.connect 'projects/:id/repository/revision', |
|
|||
304 | :action => 'revision', |
|
|||
305 | :conditions => {:method => [:get, :post]} |
|
|||
306 | end |
|
308 | end | |
307 |
|
309 | |||
308 | # additional routes for having the file name at the end of url |
|
310 | # additional routes for having the file name at the end of url | |
309 | map.connect 'attachments/:id/:filename', :controller => 'attachments', |
|
311 | map.connect 'attachments/:id/:filename', :controller => 'attachments', | |
310 | :action => 'show', :id => /\d+/, :filename => /.*/, |
|
312 | :action => 'show', :id => /\d+/, :filename => /.*/, | |
311 | :conditions => {:method => :get} |
|
313 | :conditions => {:method => :get} | |
312 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', |
|
314 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', | |
313 | :action => 'download', :id => /\d+/, :filename => /.*/, |
|
315 | :action => 'download', :id => /\d+/, :filename => /.*/, | |
314 | :conditions => {:method => :get} |
|
316 | :conditions => {:method => :get} | |
315 | map.connect 'attachments/download/:id', :controller => 'attachments', |
|
317 | map.connect 'attachments/download/:id', :controller => 'attachments', | |
316 | :action => 'download', :id => /\d+/, |
|
318 | :action => 'download', :id => /\d+/, | |
317 | :conditions => {:method => :get} |
|
319 | :conditions => {:method => :get} | |
318 | map.resources :attachments, :only => [:show, :destroy] |
|
320 | map.resources :attachments, :only => [:show, :destroy] | |
319 |
|
321 | |||
320 | map.resources :groups, :member => {:autocomplete_for_user => :get} |
|
322 | map.resources :groups, :member => {:autocomplete_for_user => :get} | |
321 | map.group_users 'groups/:id/users', :controller => 'groups', |
|
323 | map.group_users 'groups/:id/users', :controller => 'groups', | |
322 | :action => 'add_users', :id => /\d+/, |
|
324 | :action => 'add_users', :id => /\d+/, | |
323 | :conditions => {:method => :post} |
|
325 | :conditions => {:method => :post} | |
324 | map.group_user 'groups/:id/users/:user_id', :controller => 'groups', |
|
326 | map.group_user 'groups/:id/users/:user_id', :controller => 'groups', | |
325 | :action => 'remove_user', :id => /\d+/, |
|
327 | :action => 'remove_user', :id => /\d+/, | |
326 | :conditions => {:method => :delete} |
|
328 | :conditions => {:method => :delete} | |
327 | map.connect 'groups/destroy_membership/:id', :controller => 'groups', |
|
329 | map.connect 'groups/destroy_membership/:id', :controller => 'groups', | |
328 | :action => 'destroy_membership', :id => /\d+/, |
|
330 | :action => 'destroy_membership', :id => /\d+/, | |
329 | :conditions => {:method => :post} |
|
331 | :conditions => {:method => :post} | |
330 | map.connect 'groups/edit_membership/:id', :controller => 'groups', |
|
332 | map.connect 'groups/edit_membership/:id', :controller => 'groups', | |
331 | :action => 'edit_membership', :id => /\d+/, |
|
333 | :action => 'edit_membership', :id => /\d+/, | |
332 | :conditions => {:method => :post} |
|
334 | :conditions => {:method => :post} | |
333 |
|
335 | |||
334 | map.resources :trackers, :except => :show |
|
336 | map.resources :trackers, :except => :show | |
335 | map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post} |
|
337 | map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post} | |
336 | map.resources :custom_fields, :except => :show |
|
338 | map.resources :custom_fields, :except => :show | |
337 | map.resources :roles, :except => :show, :collection => {:permissions => [:get, :post]} |
|
339 | map.resources :roles, :except => :show, :collection => {:permissions => [:get, :post]} | |
338 | map.resources :enumerations, :except => :show |
|
340 | map.resources :enumerations, :except => :show | |
339 |
|
341 | |||
340 | map.connect 'search', :controller => 'search', :action => 'index', :conditions => {:method => :get} |
|
342 | map.connect 'search', :controller => 'search', :action => 'index', :conditions => {:method => :get} | |
341 |
|
343 | |||
342 | map.connect 'mail_handler', :controller => 'mail_handler', |
|
344 | map.connect 'mail_handler', :controller => 'mail_handler', | |
343 | :action => 'index', :conditions => {:method => :post} |
|
345 | :action => 'index', :conditions => {:method => :post} | |
344 |
|
346 | |||
345 | map.connect 'admin', :controller => 'admin', :action => 'index', |
|
347 | map.connect 'admin', :controller => 'admin', :action => 'index', | |
346 | :conditions => {:method => :get} |
|
348 | :conditions => {:method => :get} | |
347 | map.connect 'admin/projects', :controller => 'admin', :action => 'projects', |
|
349 | map.connect 'admin/projects', :controller => 'admin', :action => 'projects', | |
348 | :conditions => {:method => :get} |
|
350 | :conditions => {:method => :get} | |
349 | map.connect 'admin/plugins', :controller => 'admin', :action => 'plugins', |
|
351 | map.connect 'admin/plugins', :controller => 'admin', :action => 'plugins', | |
350 | :conditions => {:method => :get} |
|
352 | :conditions => {:method => :get} | |
351 | map.connect 'admin/info', :controller => 'admin', :action => 'info', |
|
353 | map.connect 'admin/info', :controller => 'admin', :action => 'info', | |
352 | :conditions => {:method => :get} |
|
354 | :conditions => {:method => :get} | |
353 | map.connect 'admin/test_email', :controller => 'admin', :action => 'test_email', |
|
355 | map.connect 'admin/test_email', :controller => 'admin', :action => 'test_email', | |
354 | :conditions => {:method => :get} |
|
356 | :conditions => {:method => :get} | |
355 | map.connect 'admin/default_configuration', :controller => 'admin', |
|
357 | map.connect 'admin/default_configuration', :controller => 'admin', | |
356 | :action => 'default_configuration', :conditions => {:method => :post} |
|
358 | :action => 'default_configuration', :conditions => {:method => :post} | |
357 |
|
359 | |||
358 | map.resources :auth_sources, :member => {:test_connection => :get} |
|
360 | map.resources :auth_sources, :member => {:test_connection => :get} | |
359 |
|
361 | |||
360 | map.connect 'workflows', :controller => 'workflows', |
|
362 | map.connect 'workflows', :controller => 'workflows', | |
361 | :action => 'index', :conditions => {:method => :get} |
|
363 | :action => 'index', :conditions => {:method => :get} | |
362 | map.connect 'workflows/edit', :controller => 'workflows', |
|
364 | map.connect 'workflows/edit', :controller => 'workflows', | |
363 | :action => 'edit', :conditions => {:method => [:get, :post]} |
|
365 | :action => 'edit', :conditions => {:method => [:get, :post]} | |
364 | map.connect 'workflows/copy', :controller => 'workflows', |
|
366 | map.connect 'workflows/copy', :controller => 'workflows', | |
365 | :action => 'copy', :conditions => {:method => [:get, :post]} |
|
367 | :action => 'copy', :conditions => {:method => [:get, :post]} | |
366 |
|
368 | |||
367 | map.connect 'settings', :controller => 'settings', |
|
369 | map.connect 'settings', :controller => 'settings', | |
368 | :action => 'index', :conditions => {:method => :get} |
|
370 | :action => 'index', :conditions => {:method => :get} | |
369 | map.connect 'settings/edit', :controller => 'settings', |
|
371 | map.connect 'settings/edit', :controller => 'settings', | |
370 | :action => 'edit', :conditions => {:method => [:get, :post]} |
|
372 | :action => 'edit', :conditions => {:method => [:get, :post]} | |
371 | map.connect 'settings/plugin/:id', :controller => 'settings', |
|
373 | map.connect 'settings/plugin/:id', :controller => 'settings', | |
372 | :action => 'plugin', :conditions => {:method => [:get, :post]} |
|
374 | :action => 'plugin', :conditions => {:method => [:get, :post]} | |
373 |
|
375 | |||
374 | map.with_options :controller => 'sys' do |sys| |
|
376 | map.with_options :controller => 'sys' do |sys| | |
375 | sys.connect 'sys/projects.:format', |
|
377 | sys.connect 'sys/projects.:format', | |
376 | :action => 'projects', |
|
378 | :action => 'projects', | |
377 | :conditions => {:method => :get} |
|
379 | :conditions => {:method => :get} | |
378 | sys.connect 'sys/projects/:id/repository.:format', |
|
380 | sys.connect 'sys/projects/:id/repository.:format', | |
379 | :action => 'create_project_repository', |
|
381 | :action => 'create_project_repository', | |
380 | :conditions => {:method => :post} |
|
382 | :conditions => {:method => :post} | |
381 | sys.connect 'sys/fetch_changesets', |
|
383 | sys.connect 'sys/fetch_changesets', | |
382 | :action => 'fetch_changesets', |
|
384 | :action => 'fetch_changesets', | |
383 | :conditions => {:method => :get} |
|
385 | :conditions => {:method => :get} | |
384 | end |
|
386 | end | |
385 |
|
387 | |||
386 | map.connect 'uploads.:format', :controller => 'attachments', :action => 'upload', :conditions => {:method => :post} |
|
388 | map.connect 'uploads.:format', :controller => 'attachments', :action => 'upload', :conditions => {:method => :post} | |
387 |
|
389 | |||
388 | map.connect 'robots.txt', :controller => 'welcome', |
|
390 | map.connect 'robots.txt', :controller => 'welcome', | |
389 | :action => 'robots', :conditions => {:method => :get} |
|
391 | :action => 'robots', :conditions => {:method => :get} | |
390 |
|
392 | |||
391 | # Used for OpenID |
|
393 | # Used for OpenID | |
392 | map.root :controller => 'account', :action => 'login' |
|
394 | map.root :controller => 'account', :action => 'login' | |
393 | end |
|
395 | end |
@@ -1,369 +1,379 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.expand_path('../../../test_helper', __FILE__) |
|
18 | require File.expand_path('../../../test_helper', __FILE__) | |
19 |
|
19 | |||
20 | class RoutingRepositoriesTest < ActionController::IntegrationTest |
|
20 | class RoutingRepositoriesTest < ActionController::IntegrationTest | |
21 | def setup |
|
21 | def setup | |
22 | @path_hash = repository_path_hash(%w[path to file.c]) |
|
22 | @path_hash = repository_path_hash(%w[path to file.c]) | |
23 | assert_equal "path/to/file.c", @path_hash[:path] |
|
23 | assert_equal "path/to/file.c", @path_hash[:path] | |
24 | assert_equal %w[path to file.c], @path_hash[:param] |
|
24 | assert_equal %w[path to file.c], @path_hash[:param] | |
25 | end |
|
25 | end | |
26 |
|
26 | |||
27 | def test_repositories_resources |
|
27 | def test_repositories_resources | |
28 | assert_routing( |
|
28 | assert_routing( | |
29 | { :method => 'get', |
|
29 | { :method => 'get', | |
30 | :path => "/projects/redmine/repositories/new" }, |
|
30 | :path => "/projects/redmine/repositories/new" }, | |
31 | { :controller => 'repositories', :action => 'new', :project_id => 'redmine' } |
|
31 | { :controller => 'repositories', :action => 'new', :project_id => 'redmine' } | |
32 | ) |
|
32 | ) | |
33 | assert_routing( |
|
33 | assert_routing( | |
34 | { :method => 'post', |
|
34 | { :method => 'post', | |
35 | :path => "/projects/redmine/repositories" }, |
|
35 | :path => "/projects/redmine/repositories" }, | |
36 | { :controller => 'repositories', :action => 'create', :project_id => 'redmine' } |
|
36 | { :controller => 'repositories', :action => 'create', :project_id => 'redmine' } | |
37 | ) |
|
37 | ) | |
38 | assert_routing( |
|
38 | assert_routing( | |
39 | { :method => 'get', |
|
39 | { :method => 'get', | |
40 | :path => "/repositories/1/edit" }, |
|
40 | :path => "/repositories/1/edit" }, | |
41 | { :controller => 'repositories', :action => 'edit', :id => '1' } |
|
41 | { :controller => 'repositories', :action => 'edit', :id => '1' } | |
42 | ) |
|
42 | ) | |
43 | assert_routing( |
|
43 | assert_routing( | |
44 | { :method => 'put', |
|
44 | { :method => 'put', | |
45 | :path => "/repositories/1" }, |
|
45 | :path => "/repositories/1" }, | |
46 | { :controller => 'repositories', :action => 'update', :id => '1' } |
|
46 | { :controller => 'repositories', :action => 'update', :id => '1' } | |
47 | ) |
|
47 | ) | |
48 | assert_routing( |
|
48 | assert_routing( | |
49 | { :method => 'delete', |
|
49 | { :method => 'delete', | |
50 | :path => "/repositories/1" }, |
|
50 | :path => "/repositories/1" }, | |
51 | { :controller => 'repositories', :action => 'destroy', :id => '1' } |
|
51 | { :controller => 'repositories', :action => 'destroy', :id => '1' } | |
52 | ) |
|
52 | ) | |
53 | ["get", "post"].each do |method| |
|
53 | ["get", "post"].each do |method| | |
54 | assert_routing( |
|
54 | assert_routing( | |
55 | { :method => method, |
|
55 | { :method => method, | |
56 | :path => "/repositories/1/committers" }, |
|
56 | :path => "/repositories/1/committers" }, | |
57 | { :controller => 'repositories', :action => 'committers', :id => '1' } |
|
57 | { :controller => 'repositories', :action => 'committers', :id => '1' } | |
58 | ) |
|
58 | ) | |
59 | end |
|
59 | end | |
60 | end |
|
60 | end | |
61 |
|
61 | |||
62 | def test_repositories_show |
|
62 | def test_repositories_show | |
63 | assert_routing( |
|
63 | assert_routing( | |
64 | { :method => 'get', |
|
64 | { :method => 'get', | |
65 | :path => "/projects/redmine/repository" }, |
|
65 | :path => "/projects/redmine/repository" }, | |
66 | { :controller => 'repositories', :action => 'show', :id => 'redmine' } |
|
66 | { :controller => 'repositories', :action => 'show', :id => 'redmine' } | |
67 | ) |
|
67 | ) | |
68 | end |
|
68 | end | |
69 |
|
69 | |||
70 | def test_repositories |
|
70 | def test_repositories | |
71 | assert_routing( |
|
71 | assert_routing( | |
72 | { :method => 'get', |
|
72 | { :method => 'get', | |
73 | :path => "/projects/redmine/repository/statistics" }, |
|
73 | :path => "/projects/redmine/repository/statistics" }, | |
74 | { :controller => 'repositories', :action => 'stats', :id => 'redmine' } |
|
74 | { :controller => 'repositories', :action => 'stats', :id => 'redmine' } | |
75 | ) |
|
75 | ) | |
76 | assert_routing( |
|
76 | assert_routing( | |
77 | { :method => 'get', |
|
77 | { :method => 'get', | |
78 | :path => "/projects/redmine/repository/graph" }, |
|
78 | :path => "/projects/redmine/repository/graph" }, | |
79 | { :controller => 'repositories', :action => 'graph', :id => 'redmine' } |
|
79 | { :controller => 'repositories', :action => 'graph', :id => 'redmine' } | |
80 | ) |
|
80 | ) | |
81 | end |
|
81 | end | |
82 |
|
82 | |||
83 | def test_repositories_show_with_repository_id |
|
83 | def test_repositories_show_with_repository_id | |
84 | assert_routing( |
|
84 | assert_routing( | |
85 | { :method => 'get', |
|
85 | { :method => 'get', | |
86 | :path => "/projects/redmine/repository/foo" }, |
|
86 | :path => "/projects/redmine/repository/foo" }, | |
87 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo' } |
|
87 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo' } | |
88 | ) |
|
88 | ) | |
89 | end |
|
89 | end | |
90 |
|
90 | |||
91 | def test_repositories_with_repository_id |
|
91 | def test_repositories_with_repository_id | |
92 | assert_routing( |
|
92 | assert_routing( | |
93 | { :method => 'get', |
|
93 | { :method => 'get', | |
94 | :path => "/projects/redmine/repository/foo/statistics" }, |
|
94 | :path => "/projects/redmine/repository/foo/statistics" }, | |
95 | { :controller => 'repositories', :action => 'stats', :id => 'redmine', :repository_id => 'foo' } |
|
95 | { :controller => 'repositories', :action => 'stats', :id => 'redmine', :repository_id => 'foo' } | |
96 | ) |
|
96 | ) | |
97 | assert_routing( |
|
97 | assert_routing( | |
98 | { :method => 'get', |
|
98 | { :method => 'get', | |
99 | :path => "/projects/redmine/repository/foo/graph" }, |
|
99 | :path => "/projects/redmine/repository/foo/graph" }, | |
100 | { :controller => 'repositories', :action => 'graph', :id => 'redmine', :repository_id => 'foo' } |
|
100 | { :controller => 'repositories', :action => 'graph', :id => 'redmine', :repository_id => 'foo' } | |
101 | ) |
|
101 | ) | |
102 | end |
|
102 | end | |
103 |
|
103 | |||
104 | def test_repositories_revisions |
|
104 | def test_repositories_revisions | |
105 | empty_path_param = [] |
|
105 | empty_path_param = [] | |
106 | assert_routing( |
|
106 | assert_routing( | |
107 | { :method => 'get', |
|
107 | { :method => 'get', | |
108 | :path => "/projects/redmine/repository/revisions" }, |
|
108 | :path => "/projects/redmine/repository/revisions" }, | |
109 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine' } |
|
109 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine' } | |
110 | ) |
|
110 | ) | |
111 | assert_routing( |
|
111 | assert_routing( | |
112 | { :method => 'get', |
|
112 | { :method => 'get', | |
113 | :path => "/projects/redmine/repository/revisions.atom" }, |
|
113 | :path => "/projects/redmine/repository/revisions.atom" }, | |
114 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', |
|
114 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', | |
115 | :format => 'atom' } |
|
115 | :format => 'atom' } | |
116 | ) |
|
116 | ) | |
117 | assert_routing( |
|
117 | assert_routing( | |
118 | { :method => 'get', |
|
118 | { :method => 'get', | |
119 | :path => "/projects/redmine/repository/revisions/2457" }, |
|
119 | :path => "/projects/redmine/repository/revisions/2457" }, | |
120 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', |
|
120 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', | |
121 | :rev => '2457' } |
|
121 | :rev => '2457' } | |
122 | ) |
|
122 | ) | |
123 | assert_routing( |
|
123 | assert_routing( | |
124 | { :method => 'get', |
|
124 | { :method => 'get', | |
125 | :path => "/projects/redmine/repository/revisions/2457/show" }, |
|
125 | :path => "/projects/redmine/repository/revisions/2457/show" }, | |
126 | { :controller => 'repositories', :action => 'show', :id => 'redmine', |
|
126 | { :controller => 'repositories', :action => 'show', :id => 'redmine', | |
127 | :path => empty_path_param, :rev => '2457' } |
|
127 | :path => empty_path_param, :rev => '2457' } | |
128 | ) |
|
128 | ) | |
129 | assert_routing( |
|
129 | assert_routing( | |
130 | { :method => 'get', |
|
130 | { :method => 'get', | |
131 | :path => "/projects/redmine/repository/revisions/2457/show/#{@path_hash[:path]}" }, |
|
131 | :path => "/projects/redmine/repository/revisions/2457/show/#{@path_hash[:path]}" }, | |
132 | { :controller => 'repositories', :action => 'show', :id => 'redmine', |
|
132 | { :controller => 'repositories', :action => 'show', :id => 'redmine', | |
133 | :path => @path_hash[:param] , :rev => '2457'} |
|
133 | :path => @path_hash[:param] , :rev => '2457'} | |
134 | ) |
|
134 | ) | |
135 | assert_routing( |
|
135 | assert_routing( | |
136 | { :method => 'get', |
|
136 | { :method => 'get', | |
137 | :path => "/projects/redmine/repository/revisions/2457/changes" }, |
|
137 | :path => "/projects/redmine/repository/revisions/2457/changes" }, | |
138 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
138 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |
139 | :path => empty_path_param, :rev => '2457' } |
|
139 | :path => empty_path_param, :rev => '2457' } | |
140 | ) |
|
140 | ) | |
141 | assert_routing( |
|
141 | assert_routing( | |
142 | { :method => 'get', |
|
142 | { :method => 'get', | |
143 | :path => "/projects/redmine/repository/revisions/2457/changes/#{@path_hash[:path]}" }, |
|
143 | :path => "/projects/redmine/repository/revisions/2457/changes/#{@path_hash[:path]}" }, | |
144 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
144 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |
145 | :path => @path_hash[:param] , :rev => '2457'} |
|
145 | :path => @path_hash[:param] , :rev => '2457'} | |
146 | ) |
|
146 | ) | |
147 | assert_routing( |
|
147 | assert_routing( | |
148 | { :method => 'get', |
|
148 | { :method => 'get', | |
149 | :path => "/projects/redmine/repository/revisions/2457/diff" }, |
|
149 | :path => "/projects/redmine/repository/revisions/2457/diff" }, | |
150 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
150 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
151 | :rev => '2457' } |
|
151 | :rev => '2457' } | |
152 | ) |
|
152 | ) | |
153 | assert_routing( |
|
153 | assert_routing( | |
154 | { :method => 'get', |
|
154 | { :method => 'get', | |
155 | :path => "/projects/redmine/repository/revisions/2457/diff.diff" }, |
|
155 | :path => "/projects/redmine/repository/revisions/2457/diff.diff" }, | |
156 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
156 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
157 | :rev => '2457', :format => 'diff' } |
|
157 | :rev => '2457', :format => 'diff' } | |
158 | ) |
|
158 | ) | |
159 | assert_routing( |
|
159 | assert_routing( | |
160 | { :method => 'get', |
|
160 | { :method => 'get', | |
161 | :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" }, |
|
161 | :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" }, | |
162 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
162 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
163 | :path => @path_hash[:param], :rev => '2' } |
|
163 | :path => @path_hash[:param], :rev => '2' } | |
164 | ) |
|
164 | ) | |
165 | assert_routing( |
|
165 | assert_routing( | |
166 | { :method => 'get', |
|
166 | { :method => 'get', | |
167 | :path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" }, |
|
167 | :path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" }, | |
168 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
168 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
169 | :path => @path_hash[:param], :rev => '2' } |
|
169 | :path => @path_hash[:param], :rev => '2' } | |
170 | ) |
|
170 | ) | |
171 | assert_routing( |
|
171 | assert_routing( | |
172 | { :method => 'get', |
|
172 | { :method => 'get', | |
173 | :path => "/projects/redmine/repository/revisions/2/raw/#{@path_hash[:path]}" }, |
|
173 | :path => "/projects/redmine/repository/revisions/2/raw/#{@path_hash[:path]}" }, | |
174 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
174 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
175 | :path => @path_hash[:param], :rev => '2', :format => 'raw' } |
|
175 | :path => @path_hash[:param], :rev => '2', :format => 'raw' } | |
176 | ) |
|
176 | ) | |
177 | assert_routing( |
|
177 | assert_routing( | |
178 | { :method => 'get', |
|
178 | { :method => 'get', | |
179 | :path => "/projects/redmine/repository/revisions/2/annotate/#{@path_hash[:path]}" }, |
|
179 | :path => "/projects/redmine/repository/revisions/2/annotate/#{@path_hash[:path]}" }, | |
180 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', |
|
180 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', | |
181 | :path => @path_hash[:param], :rev => '2' } |
|
181 | :path => @path_hash[:param], :rev => '2' } | |
182 | ) |
|
182 | ) | |
183 | end |
|
183 | end | |
184 |
|
184 | |||
185 | def test_repositories_revisions_with_repository_id |
|
185 | def test_repositories_revisions_with_repository_id | |
186 | empty_path_param = [] |
|
186 | empty_path_param = [] | |
187 | assert_routing( |
|
187 | assert_routing( | |
188 | { :method => 'get', |
|
188 | { :method => 'get', | |
189 | :path => "/projects/redmine/repository/foo/revisions" }, |
|
189 | :path => "/projects/redmine/repository/foo/revisions" }, | |
190 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo' } |
|
190 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo' } | |
191 | ) |
|
191 | ) | |
192 | assert_routing( |
|
192 | assert_routing( | |
193 | { :method => 'get', |
|
193 | { :method => 'get', | |
194 | :path => "/projects/redmine/repository/foo/revisions.atom" }, |
|
194 | :path => "/projects/redmine/repository/foo/revisions.atom" }, | |
195 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo', |
|
195 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo', | |
196 | :format => 'atom' } |
|
196 | :format => 'atom' } | |
197 | ) |
|
197 | ) | |
198 | assert_routing( |
|
198 | assert_routing( | |
199 | { :method => 'get', |
|
199 | { :method => 'get', | |
200 | :path => "/projects/redmine/repository/foo/revisions/2457" }, |
|
200 | :path => "/projects/redmine/repository/foo/revisions/2457" }, | |
201 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo', |
|
201 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo', | |
202 | :rev => '2457' } |
|
202 | :rev => '2457' } | |
203 | ) |
|
203 | ) | |
204 | assert_routing( |
|
204 | assert_routing( | |
205 | { :method => 'get', |
|
205 | { :method => 'get', | |
206 | :path => "/projects/redmine/repository/foo/revisions/2457/show" }, |
|
206 | :path => "/projects/redmine/repository/foo/revisions/2457/show" }, | |
207 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', |
|
207 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', | |
208 | :path => empty_path_param, :rev => '2457' } |
|
208 | :path => empty_path_param, :rev => '2457' } | |
209 | ) |
|
209 | ) | |
210 | assert_routing( |
|
210 | assert_routing( | |
211 | { :method => 'get', |
|
211 | { :method => 'get', | |
212 | :path => "/projects/redmine/repository/foo/revisions/2457/show/#{@path_hash[:path]}" }, |
|
212 | :path => "/projects/redmine/repository/foo/revisions/2457/show/#{@path_hash[:path]}" }, | |
213 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', |
|
213 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', | |
214 | :path => @path_hash[:param] , :rev => '2457'} |
|
214 | :path => @path_hash[:param] , :rev => '2457'} | |
215 | ) |
|
215 | ) | |
216 | assert_routing( |
|
216 | assert_routing( | |
217 | { :method => 'get', |
|
217 | { :method => 'get', | |
218 | :path => "/projects/redmine/repository/foo/revisions/2457/changes" }, |
|
218 | :path => "/projects/redmine/repository/foo/revisions/2457/changes" }, | |
219 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo', |
|
219 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo', | |
220 | :path => empty_path_param, :rev => '2457' } |
|
220 | :path => empty_path_param, :rev => '2457' } | |
221 | ) |
|
221 | ) | |
222 | assert_routing( |
|
222 | assert_routing( | |
223 | { :method => 'get', |
|
223 | { :method => 'get', | |
224 | :path => "/projects/redmine/repository/foo/revisions/2457/changes/#{@path_hash[:path]}" }, |
|
224 | :path => "/projects/redmine/repository/foo/revisions/2457/changes/#{@path_hash[:path]}" }, | |
225 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo', |
|
225 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo', | |
226 | :path => @path_hash[:param] , :rev => '2457'} |
|
226 | :path => @path_hash[:param] , :rev => '2457'} | |
227 | ) |
|
227 | ) | |
228 | assert_routing( |
|
228 | assert_routing( | |
229 | { :method => 'get', |
|
229 | { :method => 'get', | |
230 | :path => "/projects/redmine/repository/foo/revisions/2457/diff" }, |
|
230 | :path => "/projects/redmine/repository/foo/revisions/2457/diff" }, | |
231 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
231 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
232 | :rev => '2457' } |
|
232 | :rev => '2457' } | |
233 | ) |
|
233 | ) | |
234 | assert_routing( |
|
234 | assert_routing( | |
235 | { :method => 'get', |
|
235 | { :method => 'get', | |
236 | :path => "/projects/redmine/repository/foo/revisions/2457/diff.diff" }, |
|
236 | :path => "/projects/redmine/repository/foo/revisions/2457/diff.diff" }, | |
237 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
237 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
238 | :rev => '2457', :format => 'diff' } |
|
238 | :rev => '2457', :format => 'diff' } | |
239 | ) |
|
239 | ) | |
240 | assert_routing( |
|
240 | assert_routing( | |
241 | { :method => 'get', |
|
241 | { :method => 'get', | |
242 | :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" }, |
|
242 | :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" }, | |
243 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
243 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
244 | :path => @path_hash[:param], :rev => '2' } |
|
244 | :path => @path_hash[:param], :rev => '2' } | |
245 | ) |
|
245 | ) | |
246 | assert_routing( |
|
246 | assert_routing( | |
247 | { :method => 'get', |
|
247 | { :method => 'get', | |
248 | :path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" }, |
|
248 | :path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" }, | |
249 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', |
|
249 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', | |
250 | :path => @path_hash[:param], :rev => '2' } |
|
250 | :path => @path_hash[:param], :rev => '2' } | |
251 | ) |
|
251 | ) | |
252 | assert_routing( |
|
252 | assert_routing( | |
253 | { :method => 'get', |
|
253 | { :method => 'get', | |
254 | :path => "/projects/redmine/repository/foo/revisions/2/raw/#{@path_hash[:path]}" }, |
|
254 | :path => "/projects/redmine/repository/foo/revisions/2/raw/#{@path_hash[:path]}" }, | |
255 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', |
|
255 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', | |
256 | :path => @path_hash[:param], :rev => '2', :format => 'raw' } |
|
256 | :path => @path_hash[:param], :rev => '2', :format => 'raw' } | |
257 | ) |
|
257 | ) | |
258 | assert_routing( |
|
258 | assert_routing( | |
259 | { :method => 'get', |
|
259 | { :method => 'get', | |
260 | :path => "/projects/redmine/repository/foo/revisions/2/annotate/#{@path_hash[:path]}" }, |
|
260 | :path => "/projects/redmine/repository/foo/revisions/2/annotate/#{@path_hash[:path]}" }, | |
261 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', |
|
261 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', | |
262 | :path => @path_hash[:param], :rev => '2' } |
|
262 | :path => @path_hash[:param], :rev => '2' } | |
263 | ) |
|
263 | ) | |
264 | end |
|
264 | end | |
265 |
|
265 | |||
266 | def test_repositories_non_revisions_path |
|
266 | def test_repositories_non_revisions_path | |
267 | assert_routing( |
|
267 | assert_routing( | |
268 | { :method => 'get', |
|
268 | { :method => 'get', | |
269 | :path => "/projects/redmine/repository/diff/#{@path_hash[:path]}" }, |
|
269 | :path => "/projects/redmine/repository/diff/#{@path_hash[:path]}" }, | |
270 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
270 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
271 | :path => @path_hash[:param] } |
|
271 | :path => @path_hash[:param] } | |
272 | ) |
|
272 | ) | |
273 | assert_routing( |
|
273 | assert_routing( | |
274 | { :method => 'get', |
|
274 | { :method => 'get', | |
275 | :path => "/projects/redmine/repository/browse/#{@path_hash[:path]}" }, |
|
275 | :path => "/projects/redmine/repository/browse/#{@path_hash[:path]}" }, | |
276 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', |
|
276 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', | |
277 | :path => @path_hash[:param] } |
|
277 | :path => @path_hash[:param] } | |
278 | ) |
|
278 | ) | |
279 | assert_routing( |
|
279 | assert_routing( | |
280 | { :method => 'get', |
|
280 | { :method => 'get', | |
281 | :path => "/projects/redmine/repository/entry/#{@path_hash[:path]}" }, |
|
281 | :path => "/projects/redmine/repository/entry/#{@path_hash[:path]}" }, | |
282 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
282 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
283 | :path => @path_hash[:param] } |
|
283 | :path => @path_hash[:param] } | |
284 | ) |
|
284 | ) | |
285 | assert_routing( |
|
285 | assert_routing( | |
286 | { :method => 'get', |
|
286 | { :method => 'get', | |
287 | :path => "/projects/redmine/repository/raw/#{@path_hash[:path]}" }, |
|
287 | :path => "/projects/redmine/repository/raw/#{@path_hash[:path]}" }, | |
288 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
288 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
289 | :path => @path_hash[:param], :format => 'raw' } |
|
289 | :path => @path_hash[:param], :format => 'raw' } | |
290 | ) |
|
290 | ) | |
291 | assert_routing( |
|
291 | assert_routing( | |
292 | { :method => 'get', |
|
292 | { :method => 'get', | |
293 | :path => "/projects/redmine/repository/annotate/#{@path_hash[:path]}" }, |
|
293 | :path => "/projects/redmine/repository/annotate/#{@path_hash[:path]}" }, | |
294 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', |
|
294 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', | |
295 | :path => @path_hash[:param] } |
|
295 | :path => @path_hash[:param] } | |
296 | ) |
|
296 | ) | |
297 | assert_routing( |
|
297 | assert_routing( | |
298 | { :method => 'get', |
|
298 | { :method => 'get', | |
299 | :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" }, |
|
299 | :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" }, | |
300 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
300 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |
301 | :path => @path_hash[:param] } |
|
301 | :path => @path_hash[:param] } | |
302 | ) |
|
302 | ) | |
|
303 | assert_routing( | |||
|
304 | { :method => 'get', | |||
|
305 | :path => "/projects/redmine/repository/revision" }, | |||
|
306 | { :controller => 'repositories', :action => 'revision', :id => 'redmine' } | |||
|
307 | ) | |||
303 | end |
|
308 | end | |
304 |
|
309 | |||
305 | def test_repositories_non_revisions_path_with_repository_id |
|
310 | def test_repositories_non_revisions_path_with_repository_id | |
306 | assert_routing( |
|
311 | assert_routing( | |
307 | { :method => 'get', |
|
312 | { :method => 'get', | |
308 | :path => "/projects/redmine/repository/foo/diff/#{@path_hash[:path]}" }, |
|
313 | :path => "/projects/redmine/repository/foo/diff/#{@path_hash[:path]}" }, | |
309 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
314 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
310 | :path => @path_hash[:param] } |
|
315 | :path => @path_hash[:param] } | |
311 | ) |
|
316 | ) | |
312 | assert_routing( |
|
317 | assert_routing( | |
313 | { :method => 'get', |
|
318 | { :method => 'get', | |
314 | :path => "/projects/redmine/repository/foo/browse/#{@path_hash[:path]}" }, |
|
319 | :path => "/projects/redmine/repository/foo/browse/#{@path_hash[:path]}" }, | |
315 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', :repository_id => 'foo', |
|
320 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', :repository_id => 'foo', | |
316 | :path => @path_hash[:param] } |
|
321 | :path => @path_hash[:param] } | |
317 | ) |
|
322 | ) | |
318 | assert_routing( |
|
323 | assert_routing( | |
319 | { :method => 'get', |
|
324 | { :method => 'get', | |
320 | :path => "/projects/redmine/repository/foo/entry/#{@path_hash[:path]}" }, |
|
325 | :path => "/projects/redmine/repository/foo/entry/#{@path_hash[:path]}" }, | |
321 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', |
|
326 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', | |
322 | :path => @path_hash[:param] } |
|
327 | :path => @path_hash[:param] } | |
323 | ) |
|
328 | ) | |
324 | assert_routing( |
|
329 | assert_routing( | |
325 | { :method => 'get', |
|
330 | { :method => 'get', | |
326 | :path => "/projects/redmine/repository/foo/raw/#{@path_hash[:path]}" }, |
|
331 | :path => "/projects/redmine/repository/foo/raw/#{@path_hash[:path]}" }, | |
327 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', |
|
332 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', | |
328 | :path => @path_hash[:param], :format => 'raw' } |
|
333 | :path => @path_hash[:param], :format => 'raw' } | |
329 | ) |
|
334 | ) | |
330 | assert_routing( |
|
335 | assert_routing( | |
331 | { :method => 'get', |
|
336 | { :method => 'get', | |
332 | :path => "/projects/redmine/repository/foo/annotate/#{@path_hash[:path]}" }, |
|
337 | :path => "/projects/redmine/repository/foo/annotate/#{@path_hash[:path]}" }, | |
333 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', |
|
338 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', | |
334 | :path => @path_hash[:param] } |
|
339 | :path => @path_hash[:param] } | |
335 | ) |
|
340 | ) | |
336 | assert_routing( |
|
341 | assert_routing( | |
337 | { :method => 'get', |
|
342 | { :method => 'get', | |
338 | :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" }, |
|
343 | :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" }, | |
339 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo', |
|
344 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo', | |
340 | :path => @path_hash[:param] } |
|
345 | :path => @path_hash[:param] } | |
341 | ) |
|
346 | ) | |
|
347 | assert_routing( | |||
|
348 | { :method => 'get', | |||
|
349 | :path => "/projects/redmine/repository/foo/revision" }, | |||
|
350 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo'} | |||
|
351 | ) | |||
342 | end |
|
352 | end | |
343 |
|
353 | |||
344 | def test_repositories_related_issues |
|
354 | def test_repositories_related_issues | |
345 | assert_routing( |
|
355 | assert_routing( | |
346 | { :method => 'post', |
|
356 | { :method => 'post', | |
347 | :path => "/projects/redmine/repository/revisions/123/issues" }, |
|
357 | :path => "/projects/redmine/repository/revisions/123/issues" }, | |
348 | { :controller => 'repositories', :action => 'add_related_issue', :id => 'redmine', :rev => '123' } |
|
358 | { :controller => 'repositories', :action => 'add_related_issue', :id => 'redmine', :rev => '123' } | |
349 | ) |
|
359 | ) | |
350 | assert_routing( |
|
360 | assert_routing( | |
351 | { :method => 'delete', |
|
361 | { :method => 'delete', | |
352 | :path => "/projects/redmine/repository/revisions/123/issues/25" }, |
|
362 | :path => "/projects/redmine/repository/revisions/123/issues/25" }, | |
353 | { :controller => 'repositories', :action => 'remove_related_issue', :id => 'redmine', :rev => '123', :issue_id => '25' } |
|
363 | { :controller => 'repositories', :action => 'remove_related_issue', :id => 'redmine', :rev => '123', :issue_id => '25' } | |
354 | ) |
|
364 | ) | |
355 | end |
|
365 | end | |
356 |
|
366 | |||
357 | def test_repositories_related_issues_with_repository_id |
|
367 | def test_repositories_related_issues_with_repository_id | |
358 | assert_routing( |
|
368 | assert_routing( | |
359 | { :method => 'post', |
|
369 | { :method => 'post', | |
360 | :path => "/projects/redmine/repository/foo/revisions/123/issues" }, |
|
370 | :path => "/projects/redmine/repository/foo/revisions/123/issues" }, | |
361 | { :controller => 'repositories', :action => 'add_related_issue', :id => 'redmine', :repository_id => 'foo', :rev => '123' } |
|
371 | { :controller => 'repositories', :action => 'add_related_issue', :id => 'redmine', :repository_id => 'foo', :rev => '123' } | |
362 | ) |
|
372 | ) | |
363 | assert_routing( |
|
373 | assert_routing( | |
364 | { :method => 'delete', |
|
374 | { :method => 'delete', | |
365 | :path => "/projects/redmine/repository/foo/revisions/123/issues/25" }, |
|
375 | :path => "/projects/redmine/repository/foo/revisions/123/issues/25" }, | |
366 | { :controller => 'repositories', :action => 'remove_related_issue', :id => 'redmine', :repository_id => 'foo', :rev => '123', :issue_id => '25' } |
|
376 | { :controller => 'repositories', :action => 'remove_related_issue', :id => 'redmine', :repository_id => 'foo', :rev => '123', :issue_id => '25' } | |
367 | ) |
|
377 | ) | |
368 | end |
|
378 | end | |
369 | end |
|
379 | end |
General Comments 0
You need to be logged in to leave comments.
Login now