@@ -0,0 +1,32 | |||||
|
1 | # Redmine - project management software | |||
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |||
|
3 | # | |||
|
4 | # This program is free software; you can redistribute it and/or | |||
|
5 | # modify it under the terms of the GNU General Public License | |||
|
6 | # as published by the Free Software Foundation; either version 2 | |||
|
7 | # of the License, or (at your option) any later version. | |||
|
8 | # | |||
|
9 | # This program is distributed in the hope that it will be useful, | |||
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
12 | # GNU General Public License for more details. | |||
|
13 | # | |||
|
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 | |||
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
|
17 | ||||
|
18 | require File.expand_path('../../../test_helper', __FILE__) | |||
|
19 | ||||
|
20 | class RoutingGroupsTest < ActionController::IntegrationTest | |||
|
21 | def test_groups | |||
|
22 | assert_routing( | |||
|
23 | { :method => 'post', :path => "/groups/567/users" }, | |||
|
24 | { :controller => 'groups', :action => 'add_users', :id => '567' } | |||
|
25 | ) | |||
|
26 | assert_routing( | |||
|
27 | { :method => 'delete', :path => "/groups/567/users/12" }, | |||
|
28 | { :controller => 'groups', :action => 'remove_user', :id => '567', | |||
|
29 | :user_id => '12' } | |||
|
30 | ) | |||
|
31 | end | |||
|
32 | end |
@@ -1,1191 +1,1179 | |||||
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 RoutingTest < ActionController::IntegrationTest |
|
20 | class RoutingTest < ActionController::IntegrationTest | |
21 | def test_groups |
|
|||
22 | assert_routing( |
|
|||
23 | { :method => 'post', :path => "/groups/567/users" }, |
|
|||
24 | { :controller => 'groups', :action => 'add_users', :id => '567' } |
|
|||
25 | ) |
|
|||
26 | assert_routing( |
|
|||
27 | { :method => 'delete', :path => "/groups/567/users/12" }, |
|
|||
28 | { :controller => 'groups', :action => 'remove_user', :id => '567', |
|
|||
29 | :user_id => '12' } |
|
|||
30 | ) |
|
|||
31 | end |
|
|||
32 |
|
||||
33 | def test_issues_rest_actions |
|
21 | def test_issues_rest_actions | |
34 | assert_routing( |
|
22 | assert_routing( | |
35 | { :method => 'get', :path => "/issues" }, |
|
23 | { :method => 'get', :path => "/issues" }, | |
36 | { :controller => 'issues', :action => 'index' } |
|
24 | { :controller => 'issues', :action => 'index' } | |
37 | ) |
|
25 | ) | |
38 | assert_routing( |
|
26 | assert_routing( | |
39 | { :method => 'get', :path => "/issues.pdf" }, |
|
27 | { :method => 'get', :path => "/issues.pdf" }, | |
40 | { :controller => 'issues', :action => 'index', :format => 'pdf' } |
|
28 | { :controller => 'issues', :action => 'index', :format => 'pdf' } | |
41 | ) |
|
29 | ) | |
42 | assert_routing( |
|
30 | assert_routing( | |
43 | { :method => 'get', :path => "/issues.atom" }, |
|
31 | { :method => 'get', :path => "/issues.atom" }, | |
44 | { :controller => 'issues', :action => 'index', :format => 'atom' } |
|
32 | { :controller => 'issues', :action => 'index', :format => 'atom' } | |
45 | ) |
|
33 | ) | |
46 | assert_routing( |
|
34 | assert_routing( | |
47 | { :method => 'get', :path => "/issues.xml" }, |
|
35 | { :method => 'get', :path => "/issues.xml" }, | |
48 | { :controller => 'issues', :action => 'index', :format => 'xml' } |
|
36 | { :controller => 'issues', :action => 'index', :format => 'xml' } | |
49 | ) |
|
37 | ) | |
50 | assert_routing( |
|
38 | assert_routing( | |
51 | { :method => 'get', :path => "/projects/23/issues" }, |
|
39 | { :method => 'get', :path => "/projects/23/issues" }, | |
52 | { :controller => 'issues', :action => 'index', :project_id => '23' } |
|
40 | { :controller => 'issues', :action => 'index', :project_id => '23' } | |
53 | ) |
|
41 | ) | |
54 | assert_routing( |
|
42 | assert_routing( | |
55 | { :method => 'get', :path => "/projects/23/issues.pdf" }, |
|
43 | { :method => 'get', :path => "/projects/23/issues.pdf" }, | |
56 | { :controller => 'issues', :action => 'index', :project_id => '23', |
|
44 | { :controller => 'issues', :action => 'index', :project_id => '23', | |
57 | :format => 'pdf' } |
|
45 | :format => 'pdf' } | |
58 | ) |
|
46 | ) | |
59 | assert_routing( |
|
47 | assert_routing( | |
60 | { :method => 'get', :path => "/projects/23/issues.atom" }, |
|
48 | { :method => 'get', :path => "/projects/23/issues.atom" }, | |
61 | { :controller => 'issues', :action => 'index', :project_id => '23', |
|
49 | { :controller => 'issues', :action => 'index', :project_id => '23', | |
62 | :format => 'atom' } |
|
50 | :format => 'atom' } | |
63 | ) |
|
51 | ) | |
64 | assert_routing( |
|
52 | assert_routing( | |
65 | { :method => 'get', :path => "/projects/23/issues.xml" }, |
|
53 | { :method => 'get', :path => "/projects/23/issues.xml" }, | |
66 | { :controller => 'issues', :action => 'index', :project_id => '23', |
|
54 | { :controller => 'issues', :action => 'index', :project_id => '23', | |
67 | :format => 'xml' } |
|
55 | :format => 'xml' } | |
68 | ) |
|
56 | ) | |
69 | assert_routing( |
|
57 | assert_routing( | |
70 | { :method => 'get', :path => "/issues/64" }, |
|
58 | { :method => 'get', :path => "/issues/64" }, | |
71 | { :controller => 'issues', :action => 'show', :id => '64' } |
|
59 | { :controller => 'issues', :action => 'show', :id => '64' } | |
72 | ) |
|
60 | ) | |
73 | assert_routing( |
|
61 | assert_routing( | |
74 | { :method => 'get', :path => "/issues/64.pdf" }, |
|
62 | { :method => 'get', :path => "/issues/64.pdf" }, | |
75 | { :controller => 'issues', :action => 'show', :id => '64', |
|
63 | { :controller => 'issues', :action => 'show', :id => '64', | |
76 | :format => 'pdf' } |
|
64 | :format => 'pdf' } | |
77 | ) |
|
65 | ) | |
78 | assert_routing( |
|
66 | assert_routing( | |
79 | { :method => 'get', :path => "/issues/64.atom" }, |
|
67 | { :method => 'get', :path => "/issues/64.atom" }, | |
80 | { :controller => 'issues', :action => 'show', :id => '64', |
|
68 | { :controller => 'issues', :action => 'show', :id => '64', | |
81 | :format => 'atom' } |
|
69 | :format => 'atom' } | |
82 | ) |
|
70 | ) | |
83 | assert_routing( |
|
71 | assert_routing( | |
84 | { :method => 'get', :path => "/issues/64.xml" }, |
|
72 | { :method => 'get', :path => "/issues/64.xml" }, | |
85 | { :controller => 'issues', :action => 'show', :id => '64', |
|
73 | { :controller => 'issues', :action => 'show', :id => '64', | |
86 | :format => 'xml' } |
|
74 | :format => 'xml' } | |
87 | ) |
|
75 | ) | |
88 | assert_routing( |
|
76 | assert_routing( | |
89 | { :method => 'get', :path => "/projects/23/issues/new" }, |
|
77 | { :method => 'get', :path => "/projects/23/issues/new" }, | |
90 | { :controller => 'issues', :action => 'new', :project_id => '23' } |
|
78 | { :controller => 'issues', :action => 'new', :project_id => '23' } | |
91 | ) |
|
79 | ) | |
92 | end |
|
80 | end | |
93 |
|
81 | |||
94 | def test_issues_form_update |
|
82 | def test_issues_form_update | |
95 | assert_routing( |
|
83 | assert_routing( | |
96 | { :method => 'post', :path => "/projects/23/issues/new" }, |
|
84 | { :method => 'post', :path => "/projects/23/issues/new" }, | |
97 | { :controller => 'issues', :action => 'new', :project_id => '23' } |
|
85 | { :controller => 'issues', :action => 'new', :project_id => '23' } | |
98 | ) |
|
86 | ) | |
99 | assert_routing( |
|
87 | assert_routing( | |
100 | { :method => 'post', :path => "/projects/23/issues" }, |
|
88 | { :method => 'post', :path => "/projects/23/issues" }, | |
101 | { :controller => 'issues', :action => 'create', :project_id => '23' } |
|
89 | { :controller => 'issues', :action => 'create', :project_id => '23' } | |
102 | ) |
|
90 | ) | |
103 | assert_routing( |
|
91 | assert_routing( | |
104 | { :method => 'post', :path => "/issues.xml" }, |
|
92 | { :method => 'post', :path => "/issues.xml" }, | |
105 | { :controller => 'issues', :action => 'create', :format => 'xml' } |
|
93 | { :controller => 'issues', :action => 'create', :format => 'xml' } | |
106 | ) |
|
94 | ) | |
107 | assert_routing( |
|
95 | assert_routing( | |
108 | { :method => 'get', :path => "/issues/64/edit" }, |
|
96 | { :method => 'get', :path => "/issues/64/edit" }, | |
109 | { :controller => 'issues', :action => 'edit', :id => '64' } |
|
97 | { :controller => 'issues', :action => 'edit', :id => '64' } | |
110 | ) |
|
98 | ) | |
111 | assert_routing( |
|
99 | assert_routing( | |
112 | { :method => 'put', :path => "/issues/1.xml" }, |
|
100 | { :method => 'put', :path => "/issues/1.xml" }, | |
113 | { :controller => 'issues', :action => 'update', :id => '1', |
|
101 | { :controller => 'issues', :action => 'update', :id => '1', | |
114 | :format => 'xml' } |
|
102 | :format => 'xml' } | |
115 | ) |
|
103 | ) | |
116 | assert_routing( |
|
104 | assert_routing( | |
117 | { :method => 'delete', :path => "/issues/1.xml" }, |
|
105 | { :method => 'delete', :path => "/issues/1.xml" }, | |
118 | { :controller => 'issues', :action => 'destroy', :id => '1', |
|
106 | { :controller => 'issues', :action => 'destroy', :id => '1', | |
119 | :format => 'xml' } |
|
107 | :format => 'xml' } | |
120 | ) |
|
108 | ) | |
121 | end |
|
109 | end | |
122 |
|
110 | |||
123 | def test_issues_extra_actions |
|
111 | def test_issues_extra_actions | |
124 | assert_routing( |
|
112 | assert_routing( | |
125 | { :method => 'get', :path => "/projects/23/issues/64/copy" }, |
|
113 | { :method => 'get', :path => "/projects/23/issues/64/copy" }, | |
126 | { :controller => 'issues', :action => 'new', :project_id => '23', |
|
114 | { :controller => 'issues', :action => 'new', :project_id => '23', | |
127 | :copy_from => '64' } |
|
115 | :copy_from => '64' } | |
128 | ) |
|
116 | ) | |
129 | assert_routing( |
|
117 | assert_routing( | |
130 | { :method => 'get', :path => "/issues/move/new" }, |
|
118 | { :method => 'get', :path => "/issues/move/new" }, | |
131 | { :controller => 'issue_moves', :action => 'new' } |
|
119 | { :controller => 'issue_moves', :action => 'new' } | |
132 | ) |
|
120 | ) | |
133 | assert_routing( |
|
121 | assert_routing( | |
134 | { :method => 'post', :path => "/issues/move" }, |
|
122 | { :method => 'post', :path => "/issues/move" }, | |
135 | { :controller => 'issue_moves', :action => 'create' } |
|
123 | { :controller => 'issue_moves', :action => 'create' } | |
136 | ) |
|
124 | ) | |
137 | assert_routing( |
|
125 | assert_routing( | |
138 | { :method => 'post', :path => "/issues/1/quoted" }, |
|
126 | { :method => 'post', :path => "/issues/1/quoted" }, | |
139 | { :controller => 'journals', :action => 'new', :id => '1' } |
|
127 | { :controller => 'journals', :action => 'new', :id => '1' } | |
140 | ) |
|
128 | ) | |
141 | assert_routing( |
|
129 | assert_routing( | |
142 | { :method => 'get', :path => "/issues/calendar" }, |
|
130 | { :method => 'get', :path => "/issues/calendar" }, | |
143 | { :controller => 'calendars', :action => 'show' } |
|
131 | { :controller => 'calendars', :action => 'show' } | |
144 | ) |
|
132 | ) | |
145 | assert_routing( |
|
133 | assert_routing( | |
146 | { :method => 'get', :path => "/projects/project-name/issues/calendar" }, |
|
134 | { :method => 'get', :path => "/projects/project-name/issues/calendar" }, | |
147 | { :controller => 'calendars', :action => 'show', |
|
135 | { :controller => 'calendars', :action => 'show', | |
148 | :project_id => 'project-name' } |
|
136 | :project_id => 'project-name' } | |
149 | ) |
|
137 | ) | |
150 | assert_routing( |
|
138 | assert_routing( | |
151 | { :method => 'get', :path => "/issues/gantt" }, |
|
139 | { :method => 'get', :path => "/issues/gantt" }, | |
152 | { :controller => 'gantts', :action => 'show' } |
|
140 | { :controller => 'gantts', :action => 'show' } | |
153 | ) |
|
141 | ) | |
154 | assert_routing( |
|
142 | assert_routing( | |
155 | { :method => 'get', :path => "/issues/gantt.pdf" }, |
|
143 | { :method => 'get', :path => "/issues/gantt.pdf" }, | |
156 | { :controller => 'gantts', :action => 'show', :format => 'pdf' } |
|
144 | { :controller => 'gantts', :action => 'show', :format => 'pdf' } | |
157 | ) |
|
145 | ) | |
158 | assert_routing( |
|
146 | assert_routing( | |
159 | { :method => 'get', :path => "/projects/project-name/issues/gantt" }, |
|
147 | { :method => 'get', :path => "/projects/project-name/issues/gantt" }, | |
160 | { :controller => 'gantts', :action => 'show', |
|
148 | { :controller => 'gantts', :action => 'show', | |
161 | :project_id => 'project-name' } |
|
149 | :project_id => 'project-name' } | |
162 | ) |
|
150 | ) | |
163 | assert_routing( |
|
151 | assert_routing( | |
164 | { :method => 'get', :path => "/projects/project-name/issues/gantt.pdf" }, |
|
152 | { :method => 'get', :path => "/projects/project-name/issues/gantt.pdf" }, | |
165 | { :controller => 'gantts', :action => 'show', |
|
153 | { :controller => 'gantts', :action => 'show', | |
166 | :project_id => 'project-name', :format => 'pdf' } |
|
154 | :project_id => 'project-name', :format => 'pdf' } | |
167 | ) |
|
155 | ) | |
168 | assert_routing( |
|
156 | assert_routing( | |
169 | { :method => 'get', :path => "/issues/auto_complete" }, |
|
157 | { :method => 'get', :path => "/issues/auto_complete" }, | |
170 | { :controller => 'auto_completes', :action => 'issues' } |
|
158 | { :controller => 'auto_completes', :action => 'issues' } | |
171 | ) |
|
159 | ) | |
172 | assert_routing( |
|
160 | assert_routing( | |
173 | { :method => 'get', :path => "/issues/preview/123" }, |
|
161 | { :method => 'get', :path => "/issues/preview/123" }, | |
174 | { :controller => 'previews', :action => 'issue', :id => '123' } |
|
162 | { :controller => 'previews', :action => 'issue', :id => '123' } | |
175 | ) |
|
163 | ) | |
176 | assert_routing( |
|
164 | assert_routing( | |
177 | { :method => 'post', :path => "/issues/preview/123" }, |
|
165 | { :method => 'post', :path => "/issues/preview/123" }, | |
178 | { :controller => 'previews', :action => 'issue', :id => '123' } |
|
166 | { :controller => 'previews', :action => 'issue', :id => '123' } | |
179 | ) |
|
167 | ) | |
180 | assert_routing( |
|
168 | assert_routing( | |
181 | { :method => 'get', :path => "/issues/context_menu" }, |
|
169 | { :method => 'get', :path => "/issues/context_menu" }, | |
182 | { :controller => 'context_menus', :action => 'issues' } |
|
170 | { :controller => 'context_menus', :action => 'issues' } | |
183 | ) |
|
171 | ) | |
184 | assert_routing( |
|
172 | assert_routing( | |
185 | { :method => 'post', :path => "/issues/context_menu" }, |
|
173 | { :method => 'post', :path => "/issues/context_menu" }, | |
186 | { :controller => 'context_menus', :action => 'issues' } |
|
174 | { :controller => 'context_menus', :action => 'issues' } | |
187 | ) |
|
175 | ) | |
188 | assert_routing( |
|
176 | assert_routing( | |
189 | { :method => 'get', :path => "/issues/changes" }, |
|
177 | { :method => 'get', :path => "/issues/changes" }, | |
190 | { :controller => 'journals', :action => 'index' } |
|
178 | { :controller => 'journals', :action => 'index' } | |
191 | ) |
|
179 | ) | |
192 | assert_routing( |
|
180 | assert_routing( | |
193 | { :method => 'get', :path => "/issues/bulk_edit" }, |
|
181 | { :method => 'get', :path => "/issues/bulk_edit" }, | |
194 | { :controller => 'issues', :action => 'bulk_edit' } |
|
182 | { :controller => 'issues', :action => 'bulk_edit' } | |
195 | ) |
|
183 | ) | |
196 | assert_routing( |
|
184 | assert_routing( | |
197 | { :method => 'post', :path => "/issues/bulk_update" }, |
|
185 | { :method => 'post', :path => "/issues/bulk_update" }, | |
198 | { :controller => 'issues', :action => 'bulk_update' } |
|
186 | { :controller => 'issues', :action => 'bulk_update' } | |
199 | ) |
|
187 | ) | |
200 | end |
|
188 | end | |
201 |
|
189 | |||
202 | def test_issue_categories |
|
190 | def test_issue_categories | |
203 | assert_routing( |
|
191 | assert_routing( | |
204 | { :method => 'get', :path => "/projects/foo/issue_categories" }, |
|
192 | { :method => 'get', :path => "/projects/foo/issue_categories" }, | |
205 | { :controller => 'issue_categories', :action => 'index', |
|
193 | { :controller => 'issue_categories', :action => 'index', | |
206 | :project_id => 'foo' } |
|
194 | :project_id => 'foo' } | |
207 | ) |
|
195 | ) | |
208 | assert_routing( |
|
196 | assert_routing( | |
209 | { :method => 'get', :path => "/projects/foo/issue_categories.xml" }, |
|
197 | { :method => 'get', :path => "/projects/foo/issue_categories.xml" }, | |
210 | { :controller => 'issue_categories', :action => 'index', |
|
198 | { :controller => 'issue_categories', :action => 'index', | |
211 | :project_id => 'foo', :format => 'xml' } |
|
199 | :project_id => 'foo', :format => 'xml' } | |
212 | ) |
|
200 | ) | |
213 | assert_routing( |
|
201 | assert_routing( | |
214 | { :method => 'get', :path => "/projects/foo/issue_categories.json" }, |
|
202 | { :method => 'get', :path => "/projects/foo/issue_categories.json" }, | |
215 | { :controller => 'issue_categories', :action => 'index', |
|
203 | { :controller => 'issue_categories', :action => 'index', | |
216 | :project_id => 'foo', :format => 'json' } |
|
204 | :project_id => 'foo', :format => 'json' } | |
217 | ) |
|
205 | ) | |
218 | assert_routing( |
|
206 | assert_routing( | |
219 | { :method => 'get', :path => "/projects/foo/issue_categories/new" }, |
|
207 | { :method => 'get', :path => "/projects/foo/issue_categories/new" }, | |
220 | { :controller => 'issue_categories', :action => 'new', |
|
208 | { :controller => 'issue_categories', :action => 'new', | |
221 | :project_id => 'foo' } |
|
209 | :project_id => 'foo' } | |
222 | ) |
|
210 | ) | |
223 | assert_routing( |
|
211 | assert_routing( | |
224 | { :method => 'post', :path => "/projects/foo/issue_categories" }, |
|
212 | { :method => 'post', :path => "/projects/foo/issue_categories" }, | |
225 | { :controller => 'issue_categories', :action => 'create', |
|
213 | { :controller => 'issue_categories', :action => 'create', | |
226 | :project_id => 'foo' } |
|
214 | :project_id => 'foo' } | |
227 | ) |
|
215 | ) | |
228 | assert_routing( |
|
216 | assert_routing( | |
229 | { :method => 'post', :path => "/projects/foo/issue_categories.xml" }, |
|
217 | { :method => 'post', :path => "/projects/foo/issue_categories.xml" }, | |
230 | { :controller => 'issue_categories', :action => 'create', |
|
218 | { :controller => 'issue_categories', :action => 'create', | |
231 | :project_id => 'foo', :format => 'xml' } |
|
219 | :project_id => 'foo', :format => 'xml' } | |
232 | ) |
|
220 | ) | |
233 | assert_routing( |
|
221 | assert_routing( | |
234 | { :method => 'post', :path => "/projects/foo/issue_categories.json" }, |
|
222 | { :method => 'post', :path => "/projects/foo/issue_categories.json" }, | |
235 | { :controller => 'issue_categories', :action => 'create', |
|
223 | { :controller => 'issue_categories', :action => 'create', | |
236 | :project_id => 'foo', :format => 'json' } |
|
224 | :project_id => 'foo', :format => 'json' } | |
237 | ) |
|
225 | ) | |
238 | assert_routing( |
|
226 | assert_routing( | |
239 | { :method => 'get', :path => "/issue_categories/1" }, |
|
227 | { :method => 'get', :path => "/issue_categories/1" }, | |
240 | { :controller => 'issue_categories', :action => 'show', :id => '1' } |
|
228 | { :controller => 'issue_categories', :action => 'show', :id => '1' } | |
241 | ) |
|
229 | ) | |
242 | assert_routing( |
|
230 | assert_routing( | |
243 | { :method => 'get', :path => "/issue_categories/1.xml" }, |
|
231 | { :method => 'get', :path => "/issue_categories/1.xml" }, | |
244 | { :controller => 'issue_categories', :action => 'show', :id => '1', |
|
232 | { :controller => 'issue_categories', :action => 'show', :id => '1', | |
245 | :format => 'xml' } |
|
233 | :format => 'xml' } | |
246 | ) |
|
234 | ) | |
247 | assert_routing( |
|
235 | assert_routing( | |
248 | { :method => 'get', :path => "/issue_categories/1.json" }, |
|
236 | { :method => 'get', :path => "/issue_categories/1.json" }, | |
249 | { :controller => 'issue_categories', :action => 'show', :id => '1', |
|
237 | { :controller => 'issue_categories', :action => 'show', :id => '1', | |
250 | :format => 'json' } |
|
238 | :format => 'json' } | |
251 | ) |
|
239 | ) | |
252 | assert_routing( |
|
240 | assert_routing( | |
253 | { :method => 'get', :path => "/issue_categories/1/edit" }, |
|
241 | { :method => 'get', :path => "/issue_categories/1/edit" }, | |
254 | { :controller => 'issue_categories', :action => 'edit', :id => '1' } |
|
242 | { :controller => 'issue_categories', :action => 'edit', :id => '1' } | |
255 | ) |
|
243 | ) | |
256 | assert_routing( |
|
244 | assert_routing( | |
257 | { :method => 'put', :path => "/issue_categories/1" }, |
|
245 | { :method => 'put', :path => "/issue_categories/1" }, | |
258 | { :controller => 'issue_categories', :action => 'update', :id => '1' } |
|
246 | { :controller => 'issue_categories', :action => 'update', :id => '1' } | |
259 | ) |
|
247 | ) | |
260 | assert_routing( |
|
248 | assert_routing( | |
261 | { :method => 'put', :path => "/issue_categories/1.xml" }, |
|
249 | { :method => 'put', :path => "/issue_categories/1.xml" }, | |
262 | { :controller => 'issue_categories', :action => 'update', :id => '1', |
|
250 | { :controller => 'issue_categories', :action => 'update', :id => '1', | |
263 | :format => 'xml' } |
|
251 | :format => 'xml' } | |
264 | ) |
|
252 | ) | |
265 | assert_routing( |
|
253 | assert_routing( | |
266 | { :method => 'put', :path => "/issue_categories/1.json" }, |
|
254 | { :method => 'put', :path => "/issue_categories/1.json" }, | |
267 | { :controller => 'issue_categories', :action => 'update', :id => '1', |
|
255 | { :controller => 'issue_categories', :action => 'update', :id => '1', | |
268 | :format => 'json' } |
|
256 | :format => 'json' } | |
269 | ) |
|
257 | ) | |
270 | assert_routing( |
|
258 | assert_routing( | |
271 | { :method => 'delete', :path => "/issue_categories/1" }, |
|
259 | { :method => 'delete', :path => "/issue_categories/1" }, | |
272 | { :controller => 'issue_categories', :action => 'destroy', :id => '1' } |
|
260 | { :controller => 'issue_categories', :action => 'destroy', :id => '1' } | |
273 | ) |
|
261 | ) | |
274 | assert_routing( |
|
262 | assert_routing( | |
275 | { :method => 'delete', :path => "/issue_categories/1.xml" }, |
|
263 | { :method => 'delete', :path => "/issue_categories/1.xml" }, | |
276 | { :controller => 'issue_categories', :action => 'destroy', :id => '1', |
|
264 | { :controller => 'issue_categories', :action => 'destroy', :id => '1', | |
277 | :format => 'xml' } |
|
265 | :format => 'xml' } | |
278 | ) |
|
266 | ) | |
279 | assert_routing( |
|
267 | assert_routing( | |
280 | { :method => 'delete', :path => "/issue_categories/1.json" }, |
|
268 | { :method => 'delete', :path => "/issue_categories/1.json" }, | |
281 | { :controller => 'issue_categories', :action => 'destroy', :id => '1', |
|
269 | { :controller => 'issue_categories', :action => 'destroy', :id => '1', | |
282 | :format => 'json' } |
|
270 | :format => 'json' } | |
283 | ) |
|
271 | ) | |
284 | end |
|
272 | end | |
285 |
|
273 | |||
286 | def test_issue_relations |
|
274 | def test_issue_relations | |
287 | assert_routing( |
|
275 | assert_routing( | |
288 | { :method => 'get', :path => "/issues/1/relations" }, |
|
276 | { :method => 'get', :path => "/issues/1/relations" }, | |
289 | { :controller => 'issue_relations', :action => 'index', |
|
277 | { :controller => 'issue_relations', :action => 'index', | |
290 | :issue_id => '1' } |
|
278 | :issue_id => '1' } | |
291 | ) |
|
279 | ) | |
292 | assert_routing( |
|
280 | assert_routing( | |
293 | { :method => 'get', :path => "/issues/1/relations.xml" }, |
|
281 | { :method => 'get', :path => "/issues/1/relations.xml" }, | |
294 | { :controller => 'issue_relations', :action => 'index', |
|
282 | { :controller => 'issue_relations', :action => 'index', | |
295 | :issue_id => '1', :format => 'xml' } |
|
283 | :issue_id => '1', :format => 'xml' } | |
296 | ) |
|
284 | ) | |
297 | assert_routing( |
|
285 | assert_routing( | |
298 | { :method => 'get', :path => "/issues/1/relations.json" }, |
|
286 | { :method => 'get', :path => "/issues/1/relations.json" }, | |
299 | { :controller => 'issue_relations', :action => 'index', |
|
287 | { :controller => 'issue_relations', :action => 'index', | |
300 | :issue_id => '1', :format => 'json' } |
|
288 | :issue_id => '1', :format => 'json' } | |
301 | ) |
|
289 | ) | |
302 | assert_routing( |
|
290 | assert_routing( | |
303 | { :method => 'post', :path => "/issues/1/relations" }, |
|
291 | { :method => 'post', :path => "/issues/1/relations" }, | |
304 | { :controller => 'issue_relations', :action => 'create', |
|
292 | { :controller => 'issue_relations', :action => 'create', | |
305 | :issue_id => '1' } |
|
293 | :issue_id => '1' } | |
306 | ) |
|
294 | ) | |
307 | assert_routing( |
|
295 | assert_routing( | |
308 | { :method => 'post', :path => "/issues/1/relations.xml" }, |
|
296 | { :method => 'post', :path => "/issues/1/relations.xml" }, | |
309 | { :controller => 'issue_relations', :action => 'create', |
|
297 | { :controller => 'issue_relations', :action => 'create', | |
310 | :issue_id => '1', :format => 'xml' } |
|
298 | :issue_id => '1', :format => 'xml' } | |
311 | ) |
|
299 | ) | |
312 | assert_routing( |
|
300 | assert_routing( | |
313 | { :method => 'post', :path => "/issues/1/relations.json" }, |
|
301 | { :method => 'post', :path => "/issues/1/relations.json" }, | |
314 | { :controller => 'issue_relations', :action => 'create', |
|
302 | { :controller => 'issue_relations', :action => 'create', | |
315 | :issue_id => '1', :format => 'json' } |
|
303 | :issue_id => '1', :format => 'json' } | |
316 | ) |
|
304 | ) | |
317 | assert_routing( |
|
305 | assert_routing( | |
318 | { :method => 'get', :path => "/relations/23" }, |
|
306 | { :method => 'get', :path => "/relations/23" }, | |
319 | { :controller => 'issue_relations', :action => 'show', :id => '23' } |
|
307 | { :controller => 'issue_relations', :action => 'show', :id => '23' } | |
320 | ) |
|
308 | ) | |
321 | assert_routing( |
|
309 | assert_routing( | |
322 | { :method => 'get', :path => "/relations/23.xml" }, |
|
310 | { :method => 'get', :path => "/relations/23.xml" }, | |
323 | { :controller => 'issue_relations', :action => 'show', :id => '23', |
|
311 | { :controller => 'issue_relations', :action => 'show', :id => '23', | |
324 | :format => 'xml' } |
|
312 | :format => 'xml' } | |
325 | ) |
|
313 | ) | |
326 | assert_routing( |
|
314 | assert_routing( | |
327 | { :method => 'get', :path => "/relations/23.json" }, |
|
315 | { :method => 'get', :path => "/relations/23.json" }, | |
328 | { :controller => 'issue_relations', :action => 'show', :id => '23', |
|
316 | { :controller => 'issue_relations', :action => 'show', :id => '23', | |
329 | :format => 'json' } |
|
317 | :format => 'json' } | |
330 | ) |
|
318 | ) | |
331 | assert_routing( |
|
319 | assert_routing( | |
332 | { :method => 'delete', :path => "/relations/23" }, |
|
320 | { :method => 'delete', :path => "/relations/23" }, | |
333 | { :controller => 'issue_relations', :action => 'destroy', :id => '23' } |
|
321 | { :controller => 'issue_relations', :action => 'destroy', :id => '23' } | |
334 | ) |
|
322 | ) | |
335 | assert_routing( |
|
323 | assert_routing( | |
336 | { :method => 'delete', :path => "/relations/23.xml" }, |
|
324 | { :method => 'delete', :path => "/relations/23.xml" }, | |
337 | { :controller => 'issue_relations', :action => 'destroy', :id => '23', |
|
325 | { :controller => 'issue_relations', :action => 'destroy', :id => '23', | |
338 | :format => 'xml' } |
|
326 | :format => 'xml' } | |
339 | ) |
|
327 | ) | |
340 | assert_routing( |
|
328 | assert_routing( | |
341 | { :method => 'delete', :path => "/relations/23.json" }, |
|
329 | { :method => 'delete', :path => "/relations/23.json" }, | |
342 | { :controller => 'issue_relations', :action => 'destroy', :id => '23', |
|
330 | { :controller => 'issue_relations', :action => 'destroy', :id => '23', | |
343 | :format => 'json' } |
|
331 | :format => 'json' } | |
344 | ) |
|
332 | ) | |
345 | end |
|
333 | end | |
346 |
|
334 | |||
347 | def test_issue_reports |
|
335 | def test_issue_reports | |
348 | assert_routing( |
|
336 | assert_routing( | |
349 | { :method => 'get', :path => "/projects/567/issues/report" }, |
|
337 | { :method => 'get', :path => "/projects/567/issues/report" }, | |
350 | { :controller => 'reports', :action => 'issue_report', :id => '567' } |
|
338 | { :controller => 'reports', :action => 'issue_report', :id => '567' } | |
351 | ) |
|
339 | ) | |
352 | assert_routing( |
|
340 | assert_routing( | |
353 | { :method => 'get', :path => "/projects/567/issues/report/assigned_to" }, |
|
341 | { :method => 'get', :path => "/projects/567/issues/report/assigned_to" }, | |
354 | { :controller => 'reports', :action => 'issue_report_details', |
|
342 | { :controller => 'reports', :action => 'issue_report_details', | |
355 | :id => '567', :detail => 'assigned_to' } |
|
343 | :id => '567', :detail => 'assigned_to' } | |
356 | ) |
|
344 | ) | |
357 | end |
|
345 | end | |
358 |
|
346 | |||
359 | def test_members |
|
347 | def test_members | |
360 | assert_routing( |
|
348 | assert_routing( | |
361 | { :method => 'post', :path => "/projects/5234/members/new" }, |
|
349 | { :method => 'post', :path => "/projects/5234/members/new" }, | |
362 | { :controller => 'members', :action => 'new', :id => '5234' } |
|
350 | { :controller => 'members', :action => 'new', :id => '5234' } | |
363 | ) |
|
351 | ) | |
364 | end |
|
352 | end | |
365 |
|
353 | |||
366 | def test_news |
|
354 | def test_news | |
367 | assert_routing( |
|
355 | assert_routing( | |
368 | { :method => 'get', :path => "/news" }, |
|
356 | { :method => 'get', :path => "/news" }, | |
369 | { :controller => 'news', :action => 'index' } |
|
357 | { :controller => 'news', :action => 'index' } | |
370 | ) |
|
358 | ) | |
371 | assert_routing( |
|
359 | assert_routing( | |
372 | { :method => 'get', :path => "/news.atom" }, |
|
360 | { :method => 'get', :path => "/news.atom" }, | |
373 | { :controller => 'news', :action => 'index', :format => 'atom' } |
|
361 | { :controller => 'news', :action => 'index', :format => 'atom' } | |
374 | ) |
|
362 | ) | |
375 | assert_routing( |
|
363 | assert_routing( | |
376 | { :method => 'get', :path => "/news.xml" }, |
|
364 | { :method => 'get', :path => "/news.xml" }, | |
377 | { :controller => 'news', :action => 'index', :format => 'xml' } |
|
365 | { :controller => 'news', :action => 'index', :format => 'xml' } | |
378 | ) |
|
366 | ) | |
379 | assert_routing( |
|
367 | assert_routing( | |
380 | { :method => 'get', :path => "/news.json" }, |
|
368 | { :method => 'get', :path => "/news.json" }, | |
381 | { :controller => 'news', :action => 'index', :format => 'json' } |
|
369 | { :controller => 'news', :action => 'index', :format => 'json' } | |
382 | ) |
|
370 | ) | |
383 | assert_routing( |
|
371 | assert_routing( | |
384 | { :method => 'get', :path => "/projects/567/news" }, |
|
372 | { :method => 'get', :path => "/projects/567/news" }, | |
385 | { :controller => 'news', :action => 'index', :project_id => '567' } |
|
373 | { :controller => 'news', :action => 'index', :project_id => '567' } | |
386 | ) |
|
374 | ) | |
387 | assert_routing( |
|
375 | assert_routing( | |
388 | { :method => 'get', :path => "/projects/567/news.atom" }, |
|
376 | { :method => 'get', :path => "/projects/567/news.atom" }, | |
389 | { :controller => 'news', :action => 'index', :format => 'atom', |
|
377 | { :controller => 'news', :action => 'index', :format => 'atom', | |
390 | :project_id => '567' } |
|
378 | :project_id => '567' } | |
391 | ) |
|
379 | ) | |
392 | assert_routing( |
|
380 | assert_routing( | |
393 | { :method => 'get', :path => "/projects/567/news.xml" }, |
|
381 | { :method => 'get', :path => "/projects/567/news.xml" }, | |
394 | { :controller => 'news', :action => 'index', :format => 'xml', |
|
382 | { :controller => 'news', :action => 'index', :format => 'xml', | |
395 | :project_id => '567' } |
|
383 | :project_id => '567' } | |
396 | ) |
|
384 | ) | |
397 | assert_routing( |
|
385 | assert_routing( | |
398 | { :method => 'get', :path => "/projects/567/news.json" }, |
|
386 | { :method => 'get', :path => "/projects/567/news.json" }, | |
399 | { :controller => 'news', :action => 'index', :format => 'json', |
|
387 | { :controller => 'news', :action => 'index', :format => 'json', | |
400 | :project_id => '567' } |
|
388 | :project_id => '567' } | |
401 | ) |
|
389 | ) | |
402 | assert_routing( |
|
390 | assert_routing( | |
403 | { :method => 'get', :path => "/news/2" }, |
|
391 | { :method => 'get', :path => "/news/2" }, | |
404 | { :controller => 'news', :action => 'show', :id => '2' } |
|
392 | { :controller => 'news', :action => 'show', :id => '2' } | |
405 | ) |
|
393 | ) | |
406 | assert_routing( |
|
394 | assert_routing( | |
407 | { :method => 'get', :path => "/projects/567/news/new" }, |
|
395 | { :method => 'get', :path => "/projects/567/news/new" }, | |
408 | { :controller => 'news', :action => 'new', :project_id => '567' } |
|
396 | { :controller => 'news', :action => 'new', :project_id => '567' } | |
409 | ) |
|
397 | ) | |
410 | assert_routing( |
|
398 | assert_routing( | |
411 | { :method => 'get', :path => "/news/234" }, |
|
399 | { :method => 'get', :path => "/news/234" }, | |
412 | { :controller => 'news', :action => 'show', :id => '234' } |
|
400 | { :controller => 'news', :action => 'show', :id => '234' } | |
413 | ) |
|
401 | ) | |
414 | assert_routing( |
|
402 | assert_routing( | |
415 | { :method => 'get', :path => "/news/567/edit" }, |
|
403 | { :method => 'get', :path => "/news/567/edit" }, | |
416 | { :controller => 'news', :action => 'edit', :id => '567' } |
|
404 | { :controller => 'news', :action => 'edit', :id => '567' } | |
417 | ) |
|
405 | ) | |
418 | assert_routing( |
|
406 | assert_routing( | |
419 | { :method => 'get', :path => "/news/preview" }, |
|
407 | { :method => 'get', :path => "/news/preview" }, | |
420 | { :controller => 'previews', :action => 'news' } |
|
408 | { :controller => 'previews', :action => 'news' } | |
421 | ) |
|
409 | ) | |
422 | assert_routing( |
|
410 | assert_routing( | |
423 | { :method => 'post', :path => "/projects/567/news" }, |
|
411 | { :method => 'post', :path => "/projects/567/news" }, | |
424 | { :controller => 'news', :action => 'create', :project_id => '567' } |
|
412 | { :controller => 'news', :action => 'create', :project_id => '567' } | |
425 | ) |
|
413 | ) | |
426 | assert_routing( |
|
414 | assert_routing( | |
427 | { :method => 'post', :path => "/news/567/comments" }, |
|
415 | { :method => 'post', :path => "/news/567/comments" }, | |
428 | { :controller => 'comments', :action => 'create', :id => '567' } |
|
416 | { :controller => 'comments', :action => 'create', :id => '567' } | |
429 | ) |
|
417 | ) | |
430 | assert_routing( |
|
418 | assert_routing( | |
431 | { :method => 'put', :path => "/news/567" }, |
|
419 | { :method => 'put', :path => "/news/567" }, | |
432 | { :controller => 'news', :action => 'update', :id => '567' } |
|
420 | { :controller => 'news', :action => 'update', :id => '567' } | |
433 | ) |
|
421 | ) | |
434 | assert_routing( |
|
422 | assert_routing( | |
435 | { :method => 'delete', :path => "/news/567" }, |
|
423 | { :method => 'delete', :path => "/news/567" }, | |
436 | { :controller => 'news', :action => 'destroy', :id => '567' } |
|
424 | { :controller => 'news', :action => 'destroy', :id => '567' } | |
437 | ) |
|
425 | ) | |
438 | assert_routing( |
|
426 | assert_routing( | |
439 | { :method => 'delete', :path => "/news/567/comments/15" }, |
|
427 | { :method => 'delete', :path => "/news/567/comments/15" }, | |
440 | { :controller => 'comments', :action => 'destroy', :id => '567', |
|
428 | { :controller => 'comments', :action => 'destroy', :id => '567', | |
441 | :comment_id => '15' } |
|
429 | :comment_id => '15' } | |
442 | ) |
|
430 | ) | |
443 | end |
|
431 | end | |
444 |
|
432 | |||
445 | def test_projects |
|
433 | def test_projects | |
446 | assert_routing( |
|
434 | assert_routing( | |
447 | { :method => 'get', :path => "/projects" }, |
|
435 | { :method => 'get', :path => "/projects" }, | |
448 | { :controller => 'projects', :action => 'index' } |
|
436 | { :controller => 'projects', :action => 'index' } | |
449 | ) |
|
437 | ) | |
450 | assert_routing( |
|
438 | assert_routing( | |
451 | { :method => 'get', :path => "/projects.atom" }, |
|
439 | { :method => 'get', :path => "/projects.atom" }, | |
452 | { :controller => 'projects', :action => 'index', :format => 'atom' } |
|
440 | { :controller => 'projects', :action => 'index', :format => 'atom' } | |
453 | ) |
|
441 | ) | |
454 | assert_routing( |
|
442 | assert_routing( | |
455 | { :method => 'get', :path => "/projects.xml" }, |
|
443 | { :method => 'get', :path => "/projects.xml" }, | |
456 | { :controller => 'projects', :action => 'index', :format => 'xml' } |
|
444 | { :controller => 'projects', :action => 'index', :format => 'xml' } | |
457 | ) |
|
445 | ) | |
458 | assert_routing( |
|
446 | assert_routing( | |
459 | { :method => 'get', :path => "/projects/new" }, |
|
447 | { :method => 'get', :path => "/projects/new" }, | |
460 | { :controller => 'projects', :action => 'new' } |
|
448 | { :controller => 'projects', :action => 'new' } | |
461 | ) |
|
449 | ) | |
462 | assert_routing( |
|
450 | assert_routing( | |
463 | { :method => 'get', :path => "/projects/test" }, |
|
451 | { :method => 'get', :path => "/projects/test" }, | |
464 | { :controller => 'projects', :action => 'show', :id => 'test' } |
|
452 | { :controller => 'projects', :action => 'show', :id => 'test' } | |
465 | ) |
|
453 | ) | |
466 | assert_routing( |
|
454 | assert_routing( | |
467 | { :method => 'get', :path => "/projects/1.xml" }, |
|
455 | { :method => 'get', :path => "/projects/1.xml" }, | |
468 | { :controller => 'projects', :action => 'show', :id => '1', |
|
456 | { :controller => 'projects', :action => 'show', :id => '1', | |
469 | :format => 'xml' } |
|
457 | :format => 'xml' } | |
470 | ) |
|
458 | ) | |
471 | assert_routing( |
|
459 | assert_routing( | |
472 | { :method => 'get', :path => "/projects/4223/settings" }, |
|
460 | { :method => 'get', :path => "/projects/4223/settings" }, | |
473 | { :controller => 'projects', :action => 'settings', :id => '4223' } |
|
461 | { :controller => 'projects', :action => 'settings', :id => '4223' } | |
474 | ) |
|
462 | ) | |
475 | assert_routing( |
|
463 | assert_routing( | |
476 | { :method => 'get', :path => "/projects/4223/settings/members" }, |
|
464 | { :method => 'get', :path => "/projects/4223/settings/members" }, | |
477 | { :controller => 'projects', :action => 'settings', :id => '4223', |
|
465 | { :controller => 'projects', :action => 'settings', :id => '4223', | |
478 | :tab => 'members' } |
|
466 | :tab => 'members' } | |
479 | ) |
|
467 | ) | |
480 | assert_routing( |
|
468 | assert_routing( | |
481 | { :method => 'get', :path => "/projects/33/files" }, |
|
469 | { :method => 'get', :path => "/projects/33/files" }, | |
482 | { :controller => 'files', :action => 'index', :project_id => '33' } |
|
470 | { :controller => 'files', :action => 'index', :project_id => '33' } | |
483 | ) |
|
471 | ) | |
484 | assert_routing( |
|
472 | assert_routing( | |
485 | { :method => 'get', :path => "/projects/33/files/new" }, |
|
473 | { :method => 'get', :path => "/projects/33/files/new" }, | |
486 | { :controller => 'files', :action => 'new', :project_id => '33' } |
|
474 | { :controller => 'files', :action => 'new', :project_id => '33' } | |
487 | ) |
|
475 | ) | |
488 | assert_routing( |
|
476 | assert_routing( | |
489 | { :method => 'get', :path => "/projects/33/roadmap" }, |
|
477 | { :method => 'get', :path => "/projects/33/roadmap" }, | |
490 | { :controller => 'versions', :action => 'index', :project_id => '33' } |
|
478 | { :controller => 'versions', :action => 'index', :project_id => '33' } | |
491 | ) |
|
479 | ) | |
492 | assert_routing( |
|
480 | assert_routing( | |
493 | { :method => 'get', :path => "/projects/33/activity" }, |
|
481 | { :method => 'get', :path => "/projects/33/activity" }, | |
494 | { :controller => 'activities', :action => 'index', :id => '33' } |
|
482 | { :controller => 'activities', :action => 'index', :id => '33' } | |
495 | ) |
|
483 | ) | |
496 | assert_routing( |
|
484 | assert_routing( | |
497 | { :method => 'get', :path => "/projects/33/activity.atom" }, |
|
485 | { :method => 'get', :path => "/projects/33/activity.atom" }, | |
498 | { :controller => 'activities', :action => 'index', :id => '33', |
|
486 | { :controller => 'activities', :action => 'index', :id => '33', | |
499 | :format => 'atom' } |
|
487 | :format => 'atom' } | |
500 | ) |
|
488 | ) | |
501 | assert_routing( |
|
489 | assert_routing( | |
502 | { :method => 'post', :path => "/projects" }, |
|
490 | { :method => 'post', :path => "/projects" }, | |
503 | { :controller => 'projects', :action => 'create' } |
|
491 | { :controller => 'projects', :action => 'create' } | |
504 | ) |
|
492 | ) | |
505 | assert_routing( |
|
493 | assert_routing( | |
506 | { :method => 'post', :path => "/projects.xml" }, |
|
494 | { :method => 'post', :path => "/projects.xml" }, | |
507 | { :controller => 'projects', :action => 'create', :format => 'xml' } |
|
495 | { :controller => 'projects', :action => 'create', :format => 'xml' } | |
508 | ) |
|
496 | ) | |
509 | assert_routing( |
|
497 | assert_routing( | |
510 | { :method => 'post', :path => "/projects/33/files" }, |
|
498 | { :method => 'post', :path => "/projects/33/files" }, | |
511 | { :controller => 'files', :action => 'create', :project_id => '33' } |
|
499 | { :controller => 'files', :action => 'create', :project_id => '33' } | |
512 | ) |
|
500 | ) | |
513 | assert_routing( |
|
501 | assert_routing( | |
514 | { :method => 'post', :path => "/projects/64/archive" }, |
|
502 | { :method => 'post', :path => "/projects/64/archive" }, | |
515 | { :controller => 'projects', :action => 'archive', :id => '64' } |
|
503 | { :controller => 'projects', :action => 'archive', :id => '64' } | |
516 | ) |
|
504 | ) | |
517 | assert_routing( |
|
505 | assert_routing( | |
518 | { :method => 'post', :path => "/projects/64/unarchive" }, |
|
506 | { :method => 'post', :path => "/projects/64/unarchive" }, | |
519 | { :controller => 'projects', :action => 'unarchive', :id => '64' } |
|
507 | { :controller => 'projects', :action => 'unarchive', :id => '64' } | |
520 | ) |
|
508 | ) | |
521 | assert_routing( |
|
509 | assert_routing( | |
522 | { :method => 'put', :path => "/projects/64/enumerations" }, |
|
510 | { :method => 'put', :path => "/projects/64/enumerations" }, | |
523 | { :controller => 'project_enumerations', :action => 'update', |
|
511 | { :controller => 'project_enumerations', :action => 'update', | |
524 | :project_id => '64' } |
|
512 | :project_id => '64' } | |
525 | ) |
|
513 | ) | |
526 | assert_routing( |
|
514 | assert_routing( | |
527 | { :method => 'put', :path => "/projects/4223" }, |
|
515 | { :method => 'put', :path => "/projects/4223" }, | |
528 | { :controller => 'projects', :action => 'update', :id => '4223' } |
|
516 | { :controller => 'projects', :action => 'update', :id => '4223' } | |
529 | ) |
|
517 | ) | |
530 | assert_routing( |
|
518 | assert_routing( | |
531 | { :method => 'put', :path => "/projects/1.xml" }, |
|
519 | { :method => 'put', :path => "/projects/1.xml" }, | |
532 | { :controller => 'projects', :action => 'update', :id => '1', |
|
520 | { :controller => 'projects', :action => 'update', :id => '1', | |
533 | :format => 'xml' } |
|
521 | :format => 'xml' } | |
534 | ) |
|
522 | ) | |
535 | assert_routing( |
|
523 | assert_routing( | |
536 | { :method => 'delete', :path => "/projects/64" }, |
|
524 | { :method => 'delete', :path => "/projects/64" }, | |
537 | { :controller => 'projects', :action => 'destroy', :id => '64' } |
|
525 | { :controller => 'projects', :action => 'destroy', :id => '64' } | |
538 | ) |
|
526 | ) | |
539 | assert_routing( |
|
527 | assert_routing( | |
540 | { :method => 'delete', :path => "/projects/1.xml" }, |
|
528 | { :method => 'delete', :path => "/projects/1.xml" }, | |
541 | { :controller => 'projects', :action => 'destroy', :id => '1', |
|
529 | { :controller => 'projects', :action => 'destroy', :id => '1', | |
542 | :format => 'xml' } |
|
530 | :format => 'xml' } | |
543 | ) |
|
531 | ) | |
544 | assert_routing( |
|
532 | assert_routing( | |
545 | { :method => 'delete', :path => "/projects/64/enumerations" }, |
|
533 | { :method => 'delete', :path => "/projects/64/enumerations" }, | |
546 | { :controller => 'project_enumerations', :action => 'destroy', |
|
534 | { :controller => 'project_enumerations', :action => 'destroy', | |
547 | :project_id => '64' } |
|
535 | :project_id => '64' } | |
548 | ) |
|
536 | ) | |
549 | end |
|
537 | end | |
550 |
|
538 | |||
551 | def test_queries |
|
539 | def test_queries | |
552 | assert_routing( |
|
540 | assert_routing( | |
553 | { :method => 'get', :path => "/queries.xml" }, |
|
541 | { :method => 'get', :path => "/queries.xml" }, | |
554 | { :controller => 'queries', :action => 'index', :format => 'xml' } |
|
542 | { :controller => 'queries', :action => 'index', :format => 'xml' } | |
555 | ) |
|
543 | ) | |
556 | assert_routing( |
|
544 | assert_routing( | |
557 | { :method => 'get', :path => "/queries.json" }, |
|
545 | { :method => 'get', :path => "/queries.json" }, | |
558 | { :controller => 'queries', :action => 'index', :format => 'json' } |
|
546 | { :controller => 'queries', :action => 'index', :format => 'json' } | |
559 | ) |
|
547 | ) | |
560 | assert_routing( |
|
548 | assert_routing( | |
561 | { :method => 'get', :path => "/queries/new" }, |
|
549 | { :method => 'get', :path => "/queries/new" }, | |
562 | { :controller => 'queries', :action => 'new' } |
|
550 | { :controller => 'queries', :action => 'new' } | |
563 | ) |
|
551 | ) | |
564 | assert_routing( |
|
552 | assert_routing( | |
565 | { :method => 'get', :path => "/projects/redmine/queries/new" }, |
|
553 | { :method => 'get', :path => "/projects/redmine/queries/new" }, | |
566 | { :controller => 'queries', :action => 'new', :project_id => 'redmine' } |
|
554 | { :controller => 'queries', :action => 'new', :project_id => 'redmine' } | |
567 | ) |
|
555 | ) | |
568 | assert_routing( |
|
556 | assert_routing( | |
569 | { :method => 'post', :path => "/queries" }, |
|
557 | { :method => 'post', :path => "/queries" }, | |
570 | { :controller => 'queries', :action => 'create' } |
|
558 | { :controller => 'queries', :action => 'create' } | |
571 | ) |
|
559 | ) | |
572 | assert_routing( |
|
560 | assert_routing( | |
573 | { :method => 'post', :path => "/projects/redmine/queries" }, |
|
561 | { :method => 'post', :path => "/projects/redmine/queries" }, | |
574 | { :controller => 'queries', :action => 'create', :project_id => 'redmine' } |
|
562 | { :controller => 'queries', :action => 'create', :project_id => 'redmine' } | |
575 | ) |
|
563 | ) | |
576 | assert_routing( |
|
564 | assert_routing( | |
577 | { :method => 'get', :path => "/queries/1/edit" }, |
|
565 | { :method => 'get', :path => "/queries/1/edit" }, | |
578 | { :controller => 'queries', :action => 'edit', :id => '1' } |
|
566 | { :controller => 'queries', :action => 'edit', :id => '1' } | |
579 | ) |
|
567 | ) | |
580 | assert_routing( |
|
568 | assert_routing( | |
581 | { :method => 'put', :path => "/queries/1" }, |
|
569 | { :method => 'put', :path => "/queries/1" }, | |
582 | { :controller => 'queries', :action => 'update', :id => '1' } |
|
570 | { :controller => 'queries', :action => 'update', :id => '1' } | |
583 | ) |
|
571 | ) | |
584 | assert_routing( |
|
572 | assert_routing( | |
585 | { :method => 'delete', :path => "/queries/1" }, |
|
573 | { :method => 'delete', :path => "/queries/1" }, | |
586 | { :controller => 'queries', :action => 'destroy', :id => '1' } |
|
574 | { :controller => 'queries', :action => 'destroy', :id => '1' } | |
587 | ) |
|
575 | ) | |
588 | end |
|
576 | end | |
589 |
|
577 | |||
590 | def test_repositories |
|
578 | def test_repositories | |
591 | assert_routing( |
|
579 | assert_routing( | |
592 | { :method => 'get', |
|
580 | { :method => 'get', | |
593 | :path => "/projects/redmine/repository" }, |
|
581 | :path => "/projects/redmine/repository" }, | |
594 | { :controller => 'repositories', :action => 'show', :id => 'redmine' } |
|
582 | { :controller => 'repositories', :action => 'show', :id => 'redmine' } | |
595 | ) |
|
583 | ) | |
596 | assert_routing( |
|
584 | assert_routing( | |
597 | { :method => 'get', |
|
585 | { :method => 'get', | |
598 | :path => "/projects/redmine/repository/edit" }, |
|
586 | :path => "/projects/redmine/repository/edit" }, | |
599 | { :controller => 'repositories', :action => 'edit', :id => 'redmine' } |
|
587 | { :controller => 'repositories', :action => 'edit', :id => 'redmine' } | |
600 | ) |
|
588 | ) | |
601 | assert_routing( |
|
589 | assert_routing( | |
602 | { :method => 'get', |
|
590 | { :method => 'get', | |
603 | :path => "/projects/redmine/repository/revisions" }, |
|
591 | :path => "/projects/redmine/repository/revisions" }, | |
604 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine' } |
|
592 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine' } | |
605 | ) |
|
593 | ) | |
606 | assert_routing( |
|
594 | assert_routing( | |
607 | { :method => 'get', |
|
595 | { :method => 'get', | |
608 | :path => "/projects/redmine/repository/revisions.atom" }, |
|
596 | :path => "/projects/redmine/repository/revisions.atom" }, | |
609 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', |
|
597 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', | |
610 | :format => 'atom' } |
|
598 | :format => 'atom' } | |
611 | ) |
|
599 | ) | |
612 | assert_routing( |
|
600 | assert_routing( | |
613 | { :method => 'get', |
|
601 | { :method => 'get', | |
614 | :path => "/projects/redmine/repository/revisions/2457" }, |
|
602 | :path => "/projects/redmine/repository/revisions/2457" }, | |
615 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', |
|
603 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', | |
616 | :rev => '2457' } |
|
604 | :rev => '2457' } | |
617 | ) |
|
605 | ) | |
618 | assert_routing( |
|
606 | assert_routing( | |
619 | { :method => 'get', |
|
607 | { :method => 'get', | |
620 | :path => "/projects/redmine/repository/revisions/2457/diff" }, |
|
608 | :path => "/projects/redmine/repository/revisions/2457/diff" }, | |
621 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
609 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
622 | :rev => '2457' } |
|
610 | :rev => '2457' } | |
623 | ) |
|
611 | ) | |
624 | assert_routing( |
|
612 | assert_routing( | |
625 | { :method => 'get', |
|
613 | { :method => 'get', | |
626 | :path => "/projects/redmine/repository/revisions/2457/diff.diff" }, |
|
614 | :path => "/projects/redmine/repository/revisions/2457/diff.diff" }, | |
627 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
615 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
628 | :rev => '2457', :format => 'diff' } |
|
616 | :rev => '2457', :format => 'diff' } | |
629 | ) |
|
617 | ) | |
630 | assert_routing( |
|
618 | assert_routing( | |
631 | { :method => 'get', |
|
619 | { :method => 'get', | |
632 | :path => "/projects/redmine/repository/diff/path/to/file.c" }, |
|
620 | :path => "/projects/redmine/repository/diff/path/to/file.c" }, | |
633 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
621 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
634 | :path => %w[path to file.c] } |
|
622 | :path => %w[path to file.c] } | |
635 | ) |
|
623 | ) | |
636 | assert_routing( |
|
624 | assert_routing( | |
637 | { :method => 'get', |
|
625 | { :method => 'get', | |
638 | :path => "/projects/redmine/repository/revisions/2/diff/path/to/file.c" }, |
|
626 | :path => "/projects/redmine/repository/revisions/2/diff/path/to/file.c" }, | |
639 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
627 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
640 | :path => %w[path to file.c], :rev => '2' } |
|
628 | :path => %w[path to file.c], :rev => '2' } | |
641 | ) |
|
629 | ) | |
642 | assert_routing( |
|
630 | assert_routing( | |
643 | { :method => 'get', |
|
631 | { :method => 'get', | |
644 | :path => "/projects/redmine/repository/browse/path/to/file.c" }, |
|
632 | :path => "/projects/redmine/repository/browse/path/to/file.c" }, | |
645 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', |
|
633 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', | |
646 | :path => %w[path to file.c] } |
|
634 | :path => %w[path to file.c] } | |
647 | ) |
|
635 | ) | |
648 | assert_routing( |
|
636 | assert_routing( | |
649 | { :method => 'get', |
|
637 | { :method => 'get', | |
650 | :path => "/projects/redmine/repository/entry/path/to/file.c" }, |
|
638 | :path => "/projects/redmine/repository/entry/path/to/file.c" }, | |
651 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
639 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
652 | :path => %w[path to file.c] } |
|
640 | :path => %w[path to file.c] } | |
653 | ) |
|
641 | ) | |
654 | assert_routing( |
|
642 | assert_routing( | |
655 | { :method => 'get', |
|
643 | { :method => 'get', | |
656 | :path => "/projects/redmine/repository/revisions/2/entry/path/to/file.c" }, |
|
644 | :path => "/projects/redmine/repository/revisions/2/entry/path/to/file.c" }, | |
657 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
645 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
658 | :path => %w[path to file.c], :rev => '2' } |
|
646 | :path => %w[path to file.c], :rev => '2' } | |
659 | ) |
|
647 | ) | |
660 | assert_routing( |
|
648 | assert_routing( | |
661 | { :method => 'get', |
|
649 | { :method => 'get', | |
662 | :path => "/projects/redmine/repository/raw/path/to/file.c" }, |
|
650 | :path => "/projects/redmine/repository/raw/path/to/file.c" }, | |
663 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
651 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
664 | :path => %w[path to file.c], :format => 'raw' } |
|
652 | :path => %w[path to file.c], :format => 'raw' } | |
665 | ) |
|
653 | ) | |
666 | assert_routing( |
|
654 | assert_routing( | |
667 | { :method => 'get', |
|
655 | { :method => 'get', | |
668 | :path => "/projects/redmine/repository/revisions/2/raw/path/to/file.c" }, |
|
656 | :path => "/projects/redmine/repository/revisions/2/raw/path/to/file.c" }, | |
669 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
657 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
670 | :path => %w[path to file.c], :rev => '2', :format => 'raw' } |
|
658 | :path => %w[path to file.c], :rev => '2', :format => 'raw' } | |
671 | ) |
|
659 | ) | |
672 | assert_routing( |
|
660 | assert_routing( | |
673 | { :method => 'get', |
|
661 | { :method => 'get', | |
674 | :path => "/projects/redmine/repository/annotate/path/to/file.c" }, |
|
662 | :path => "/projects/redmine/repository/annotate/path/to/file.c" }, | |
675 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', |
|
663 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', | |
676 | :path => %w[path to file.c] } |
|
664 | :path => %w[path to file.c] } | |
677 | ) |
|
665 | ) | |
678 | assert_routing( |
|
666 | assert_routing( | |
679 | { :method => 'get', |
|
667 | { :method => 'get', | |
680 | :path => "/projects/redmine/repository/changes/path/to/file.c" }, |
|
668 | :path => "/projects/redmine/repository/changes/path/to/file.c" }, | |
681 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
669 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |
682 | :path => %w[path to file.c] } |
|
670 | :path => %w[path to file.c] } | |
683 | ) |
|
671 | ) | |
684 | assert_routing( |
|
672 | assert_routing( | |
685 | { :method => 'get', |
|
673 | { :method => 'get', | |
686 | :path => "/projects/redmine/repository/statistics" }, |
|
674 | :path => "/projects/redmine/repository/statistics" }, | |
687 | { :controller => 'repositories', :action => 'stats', :id => 'redmine' } |
|
675 | { :controller => 'repositories', :action => 'stats', :id => 'redmine' } | |
688 | ) |
|
676 | ) | |
689 | assert_routing( |
|
677 | assert_routing( | |
690 | { :method => 'post', |
|
678 | { :method => 'post', | |
691 | :path => "/projects/redmine/repository/edit" }, |
|
679 | :path => "/projects/redmine/repository/edit" }, | |
692 | { :controller => 'repositories', :action => 'edit', :id => 'redmine' } |
|
680 | { :controller => 'repositories', :action => 'edit', :id => 'redmine' } | |
693 | ) |
|
681 | ) | |
694 | end |
|
682 | end | |
695 |
|
683 | |||
696 | def test_roles |
|
684 | def test_roles | |
697 | assert_routing( |
|
685 | assert_routing( | |
698 | { :method => 'get', :path => "/roles" }, |
|
686 | { :method => 'get', :path => "/roles" }, | |
699 | { :controller => 'roles', :action => 'index' } |
|
687 | { :controller => 'roles', :action => 'index' } | |
700 | ) |
|
688 | ) | |
701 | assert_routing( |
|
689 | assert_routing( | |
702 | { :method => 'get', :path => "/roles/new" }, |
|
690 | { :method => 'get', :path => "/roles/new" }, | |
703 | { :controller => 'roles', :action => 'new' } |
|
691 | { :controller => 'roles', :action => 'new' } | |
704 | ) |
|
692 | ) | |
705 | assert_routing( |
|
693 | assert_routing( | |
706 | { :method => 'post', :path => "/roles" }, |
|
694 | { :method => 'post', :path => "/roles" }, | |
707 | { :controller => 'roles', :action => 'create' } |
|
695 | { :controller => 'roles', :action => 'create' } | |
708 | ) |
|
696 | ) | |
709 | assert_routing( |
|
697 | assert_routing( | |
710 | { :method => 'get', :path => "/roles/2/edit" }, |
|
698 | { :method => 'get', :path => "/roles/2/edit" }, | |
711 | { :controller => 'roles', :action => 'edit', :id => '2' } |
|
699 | { :controller => 'roles', :action => 'edit', :id => '2' } | |
712 | ) |
|
700 | ) | |
713 | assert_routing( |
|
701 | assert_routing( | |
714 | { :method => 'put', :path => "/roles/2" }, |
|
702 | { :method => 'put', :path => "/roles/2" }, | |
715 | { :controller => 'roles', :action => 'update', :id => '2' } |
|
703 | { :controller => 'roles', :action => 'update', :id => '2' } | |
716 | ) |
|
704 | ) | |
717 | assert_routing( |
|
705 | assert_routing( | |
718 | { :method => 'delete', :path => "/roles/2" }, |
|
706 | { :method => 'delete', :path => "/roles/2" }, | |
719 | { :controller => 'roles', :action => 'destroy', :id => '2' } |
|
707 | { :controller => 'roles', :action => 'destroy', :id => '2' } | |
720 | ) |
|
708 | ) | |
721 | assert_routing( |
|
709 | assert_routing( | |
722 | { :method => 'get', :path => "/roles/permissions" }, |
|
710 | { :method => 'get', :path => "/roles/permissions" }, | |
723 | { :controller => 'roles', :action => 'permissions' } |
|
711 | { :controller => 'roles', :action => 'permissions' } | |
724 | ) |
|
712 | ) | |
725 | assert_routing( |
|
713 | assert_routing( | |
726 | { :method => 'post', :path => "/roles/permissions" }, |
|
714 | { :method => 'post', :path => "/roles/permissions" }, | |
727 | { :controller => 'roles', :action => 'permissions' } |
|
715 | { :controller => 'roles', :action => 'permissions' } | |
728 | ) |
|
716 | ) | |
729 | end |
|
717 | end | |
730 |
|
718 | |||
731 | def test_timelogs_global |
|
719 | def test_timelogs_global | |
732 | assert_routing( |
|
720 | assert_routing( | |
733 | { :method => 'get', :path => "/time_entries" }, |
|
721 | { :method => 'get', :path => "/time_entries" }, | |
734 | { :controller => 'timelog', :action => 'index' } |
|
722 | { :controller => 'timelog', :action => 'index' } | |
735 | ) |
|
723 | ) | |
736 | assert_routing( |
|
724 | assert_routing( | |
737 | { :method => 'get', :path => "/time_entries.csv" }, |
|
725 | { :method => 'get', :path => "/time_entries.csv" }, | |
738 | { :controller => 'timelog', :action => 'index', :format => 'csv' } |
|
726 | { :controller => 'timelog', :action => 'index', :format => 'csv' } | |
739 | ) |
|
727 | ) | |
740 | assert_routing( |
|
728 | assert_routing( | |
741 | { :method => 'get', :path => "/time_entries.atom" }, |
|
729 | { :method => 'get', :path => "/time_entries.atom" }, | |
742 | { :controller => 'timelog', :action => 'index', :format => 'atom' } |
|
730 | { :controller => 'timelog', :action => 'index', :format => 'atom' } | |
743 | ) |
|
731 | ) | |
744 | assert_routing( |
|
732 | assert_routing( | |
745 | { :method => 'get', :path => "/time_entries/new" }, |
|
733 | { :method => 'get', :path => "/time_entries/new" }, | |
746 | { :controller => 'timelog', :action => 'new' } |
|
734 | { :controller => 'timelog', :action => 'new' } | |
747 | ) |
|
735 | ) | |
748 | assert_routing( |
|
736 | assert_routing( | |
749 | { :method => 'get', :path => "/time_entries/22/edit" }, |
|
737 | { :method => 'get', :path => "/time_entries/22/edit" }, | |
750 | { :controller => 'timelog', :action => 'edit', :id => '22' } |
|
738 | { :controller => 'timelog', :action => 'edit', :id => '22' } | |
751 | ) |
|
739 | ) | |
752 | assert_routing( |
|
740 | assert_routing( | |
753 | { :method => 'post', :path => "/time_entries" }, |
|
741 | { :method => 'post', :path => "/time_entries" }, | |
754 | { :controller => 'timelog', :action => 'create' } |
|
742 | { :controller => 'timelog', :action => 'create' } | |
755 | ) |
|
743 | ) | |
756 | assert_routing( |
|
744 | assert_routing( | |
757 | { :method => 'put', :path => "/time_entries/22" }, |
|
745 | { :method => 'put', :path => "/time_entries/22" }, | |
758 | { :controller => 'timelog', :action => 'update', :id => '22' } |
|
746 | { :controller => 'timelog', :action => 'update', :id => '22' } | |
759 | ) |
|
747 | ) | |
760 | assert_routing( |
|
748 | assert_routing( | |
761 | { :method => 'delete', :path => "/time_entries/55" }, |
|
749 | { :method => 'delete', :path => "/time_entries/55" }, | |
762 | { :controller => 'timelog', :action => 'destroy', :id => '55' } |
|
750 | { :controller => 'timelog', :action => 'destroy', :id => '55' } | |
763 | ) |
|
751 | ) | |
764 | end |
|
752 | end | |
765 |
|
753 | |||
766 | def test_timelogs_scoped_under_project |
|
754 | def test_timelogs_scoped_under_project | |
767 | assert_routing( |
|
755 | assert_routing( | |
768 | { :method => 'get', :path => "/projects/567/time_entries" }, |
|
756 | { :method => 'get', :path => "/projects/567/time_entries" }, | |
769 | { :controller => 'timelog', :action => 'index', :project_id => '567' } |
|
757 | { :controller => 'timelog', :action => 'index', :project_id => '567' } | |
770 | ) |
|
758 | ) | |
771 | assert_routing( |
|
759 | assert_routing( | |
772 | { :method => 'get', :path => "/projects/567/time_entries.csv" }, |
|
760 | { :method => 'get', :path => "/projects/567/time_entries.csv" }, | |
773 | { :controller => 'timelog', :action => 'index', :project_id => '567', |
|
761 | { :controller => 'timelog', :action => 'index', :project_id => '567', | |
774 | :format => 'csv' } |
|
762 | :format => 'csv' } | |
775 | ) |
|
763 | ) | |
776 | assert_routing( |
|
764 | assert_routing( | |
777 | { :method => 'get', :path => "/projects/567/time_entries.atom" }, |
|
765 | { :method => 'get', :path => "/projects/567/time_entries.atom" }, | |
778 | { :controller => 'timelog', :action => 'index', :project_id => '567', |
|
766 | { :controller => 'timelog', :action => 'index', :project_id => '567', | |
779 | :format => 'atom' } |
|
767 | :format => 'atom' } | |
780 | ) |
|
768 | ) | |
781 | assert_routing( |
|
769 | assert_routing( | |
782 | { :method => 'get', :path => "/projects/567/time_entries/new" }, |
|
770 | { :method => 'get', :path => "/projects/567/time_entries/new" }, | |
783 | { :controller => 'timelog', :action => 'new', :project_id => '567' } |
|
771 | { :controller => 'timelog', :action => 'new', :project_id => '567' } | |
784 | ) |
|
772 | ) | |
785 | assert_routing( |
|
773 | assert_routing( | |
786 | { :method => 'get', :path => "/projects/567/time_entries/22/edit" }, |
|
774 | { :method => 'get', :path => "/projects/567/time_entries/22/edit" }, | |
787 | { :controller => 'timelog', :action => 'edit', |
|
775 | { :controller => 'timelog', :action => 'edit', | |
788 | :id => '22', :project_id => '567' } |
|
776 | :id => '22', :project_id => '567' } | |
789 | ) |
|
777 | ) | |
790 | assert_routing( |
|
778 | assert_routing( | |
791 | { :method => 'post', :path => "/projects/567/time_entries" }, |
|
779 | { :method => 'post', :path => "/projects/567/time_entries" }, | |
792 | { :controller => 'timelog', :action => 'create', |
|
780 | { :controller => 'timelog', :action => 'create', | |
793 | :project_id => '567' } |
|
781 | :project_id => '567' } | |
794 | ) |
|
782 | ) | |
795 | assert_routing( |
|
783 | assert_routing( | |
796 | { :method => 'put', :path => "/projects/567/time_entries/22" }, |
|
784 | { :method => 'put', :path => "/projects/567/time_entries/22" }, | |
797 | { :controller => 'timelog', :action => 'update', |
|
785 | { :controller => 'timelog', :action => 'update', | |
798 | :id => '22', :project_id => '567' } |
|
786 | :id => '22', :project_id => '567' } | |
799 | ) |
|
787 | ) | |
800 | assert_routing( |
|
788 | assert_routing( | |
801 | { :method => 'delete', :path => "/projects/567/time_entries/55" }, |
|
789 | { :method => 'delete', :path => "/projects/567/time_entries/55" }, | |
802 | { :controller => 'timelog', :action => 'destroy', |
|
790 | { :controller => 'timelog', :action => 'destroy', | |
803 | :id => '55', :project_id => '567' } |
|
791 | :id => '55', :project_id => '567' } | |
804 | ) |
|
792 | ) | |
805 | end |
|
793 | end | |
806 |
|
794 | |||
807 | def test_timelogs_scoped_under_issues |
|
795 | def test_timelogs_scoped_under_issues | |
808 | assert_routing( |
|
796 | assert_routing( | |
809 | { :method => 'get', :path => "/issues/234/time_entries" }, |
|
797 | { :method => 'get', :path => "/issues/234/time_entries" }, | |
810 | { :controller => 'timelog', :action => 'index', :issue_id => '234' } |
|
798 | { :controller => 'timelog', :action => 'index', :issue_id => '234' } | |
811 | ) |
|
799 | ) | |
812 | assert_routing( |
|
800 | assert_routing( | |
813 | { :method => 'get', :path => "/issues/234/time_entries.csv" }, |
|
801 | { :method => 'get', :path => "/issues/234/time_entries.csv" }, | |
814 | { :controller => 'timelog', :action => 'index', :issue_id => '234', |
|
802 | { :controller => 'timelog', :action => 'index', :issue_id => '234', | |
815 | :format => 'csv' } |
|
803 | :format => 'csv' } | |
816 | ) |
|
804 | ) | |
817 | assert_routing( |
|
805 | assert_routing( | |
818 | { :method => 'get', :path => "/issues/234/time_entries.atom" }, |
|
806 | { :method => 'get', :path => "/issues/234/time_entries.atom" }, | |
819 | { :controller => 'timelog', :action => 'index', :issue_id => '234', |
|
807 | { :controller => 'timelog', :action => 'index', :issue_id => '234', | |
820 | :format => 'atom' } |
|
808 | :format => 'atom' } | |
821 | ) |
|
809 | ) | |
822 | assert_routing( |
|
810 | assert_routing( | |
823 | { :method => 'get', :path => "/issues/234/time_entries/new" }, |
|
811 | { :method => 'get', :path => "/issues/234/time_entries/new" }, | |
824 | { :controller => 'timelog', :action => 'new', :issue_id => '234' } |
|
812 | { :controller => 'timelog', :action => 'new', :issue_id => '234' } | |
825 | ) |
|
813 | ) | |
826 | assert_routing( |
|
814 | assert_routing( | |
827 | { :method => 'get', :path => "/issues/234/time_entries/22/edit" }, |
|
815 | { :method => 'get', :path => "/issues/234/time_entries/22/edit" }, | |
828 | { :controller => 'timelog', :action => 'edit', :id => '22', |
|
816 | { :controller => 'timelog', :action => 'edit', :id => '22', | |
829 | :issue_id => '234' } |
|
817 | :issue_id => '234' } | |
830 | ) |
|
818 | ) | |
831 | assert_routing( |
|
819 | assert_routing( | |
832 | { :method => 'post', :path => "/issues/234/time_entries" }, |
|
820 | { :method => 'post', :path => "/issues/234/time_entries" }, | |
833 | { :controller => 'timelog', :action => 'create', :issue_id => '234' } |
|
821 | { :controller => 'timelog', :action => 'create', :issue_id => '234' } | |
834 | ) |
|
822 | ) | |
835 | assert_routing( |
|
823 | assert_routing( | |
836 | { :method => 'put', :path => "/issues/234/time_entries/22" }, |
|
824 | { :method => 'put', :path => "/issues/234/time_entries/22" }, | |
837 | { :controller => 'timelog', :action => 'update', :id => '22', |
|
825 | { :controller => 'timelog', :action => 'update', :id => '22', | |
838 | :issue_id => '234' } |
|
826 | :issue_id => '234' } | |
839 | ) |
|
827 | ) | |
840 | assert_routing( |
|
828 | assert_routing( | |
841 | { :method => 'delete', :path => "/issues/234/time_entries/55" }, |
|
829 | { :method => 'delete', :path => "/issues/234/time_entries/55" }, | |
842 | { :controller => 'timelog', :action => 'destroy', :id => '55', |
|
830 | { :controller => 'timelog', :action => 'destroy', :id => '55', | |
843 | :issue_id => '234' } |
|
831 | :issue_id => '234' } | |
844 | ) |
|
832 | ) | |
845 | end |
|
833 | end | |
846 |
|
834 | |||
847 | def test_timelogs_scoped_under_project_and_issues |
|
835 | def test_timelogs_scoped_under_project_and_issues | |
848 | assert_routing( |
|
836 | assert_routing( | |
849 | { :method => 'get', |
|
837 | { :method => 'get', | |
850 | :path => "/projects/ecookbook/issues/234/time_entries" }, |
|
838 | :path => "/projects/ecookbook/issues/234/time_entries" }, | |
851 | { :controller => 'timelog', :action => 'index', |
|
839 | { :controller => 'timelog', :action => 'index', | |
852 | :issue_id => '234', :project_id => 'ecookbook' } |
|
840 | :issue_id => '234', :project_id => 'ecookbook' } | |
853 | ) |
|
841 | ) | |
854 | assert_routing( |
|
842 | assert_routing( | |
855 | { :method => 'get', |
|
843 | { :method => 'get', | |
856 | :path => "/projects/ecookbook/issues/234/time_entries.csv" }, |
|
844 | :path => "/projects/ecookbook/issues/234/time_entries.csv" }, | |
857 | { :controller => 'timelog', :action => 'index', |
|
845 | { :controller => 'timelog', :action => 'index', | |
858 | :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' } |
|
846 | :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' } | |
859 | ) |
|
847 | ) | |
860 | assert_routing( |
|
848 | assert_routing( | |
861 | { :method => 'get', |
|
849 | { :method => 'get', | |
862 | :path => "/projects/ecookbook/issues/234/time_entries.atom" }, |
|
850 | :path => "/projects/ecookbook/issues/234/time_entries.atom" }, | |
863 | { :controller => 'timelog', :action => 'index', |
|
851 | { :controller => 'timelog', :action => 'index', | |
864 | :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' } |
|
852 | :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' } | |
865 | ) |
|
853 | ) | |
866 | assert_routing( |
|
854 | assert_routing( | |
867 | { :method => 'get', |
|
855 | { :method => 'get', | |
868 | :path => "/projects/ecookbook/issues/234/time_entries/new" }, |
|
856 | :path => "/projects/ecookbook/issues/234/time_entries/new" }, | |
869 | { :controller => 'timelog', :action => 'new', |
|
857 | { :controller => 'timelog', :action => 'new', | |
870 | :issue_id => '234', :project_id => 'ecookbook' } |
|
858 | :issue_id => '234', :project_id => 'ecookbook' } | |
871 | ) |
|
859 | ) | |
872 | assert_routing( |
|
860 | assert_routing( | |
873 | { :method => 'get', |
|
861 | { :method => 'get', | |
874 | :path => "/projects/ecookbook/issues/234/time_entries/22/edit" }, |
|
862 | :path => "/projects/ecookbook/issues/234/time_entries/22/edit" }, | |
875 | { :controller => 'timelog', :action => 'edit', :id => '22', |
|
863 | { :controller => 'timelog', :action => 'edit', :id => '22', | |
876 | :issue_id => '234', :project_id => 'ecookbook' } |
|
864 | :issue_id => '234', :project_id => 'ecookbook' } | |
877 | ) |
|
865 | ) | |
878 | assert_routing( |
|
866 | assert_routing( | |
879 | { :method => 'post', |
|
867 | { :method => 'post', | |
880 | :path => "/projects/ecookbook/issues/234/time_entries" }, |
|
868 | :path => "/projects/ecookbook/issues/234/time_entries" }, | |
881 | { :controller => 'timelog', :action => 'create', |
|
869 | { :controller => 'timelog', :action => 'create', | |
882 | :issue_id => '234', :project_id => 'ecookbook' } |
|
870 | :issue_id => '234', :project_id => 'ecookbook' } | |
883 | ) |
|
871 | ) | |
884 | assert_routing( |
|
872 | assert_routing( | |
885 | { :method => 'put', |
|
873 | { :method => 'put', | |
886 | :path => "/projects/ecookbook/issues/234/time_entries/22" }, |
|
874 | :path => "/projects/ecookbook/issues/234/time_entries/22" }, | |
887 | { :controller => 'timelog', :action => 'update', :id => '22', |
|
875 | { :controller => 'timelog', :action => 'update', :id => '22', | |
888 | :issue_id => '234', :project_id => 'ecookbook' } |
|
876 | :issue_id => '234', :project_id => 'ecookbook' } | |
889 | ) |
|
877 | ) | |
890 | assert_routing( |
|
878 | assert_routing( | |
891 | { :method => 'delete', |
|
879 | { :method => 'delete', | |
892 | :path => "/projects/ecookbook/issues/234/time_entries/55" }, |
|
880 | :path => "/projects/ecookbook/issues/234/time_entries/55" }, | |
893 | { :controller => 'timelog', :action => 'destroy', :id => '55', |
|
881 | { :controller => 'timelog', :action => 'destroy', :id => '55', | |
894 | :issue_id => '234', :project_id => 'ecookbook' } |
|
882 | :issue_id => '234', :project_id => 'ecookbook' } | |
895 | ) |
|
883 | ) | |
896 | assert_routing( |
|
884 | assert_routing( | |
897 | { :method => 'get', |
|
885 | { :method => 'get', | |
898 | :path => "/time_entries/report" }, |
|
886 | :path => "/time_entries/report" }, | |
899 | { :controller => 'timelog', :action => 'report' } |
|
887 | { :controller => 'timelog', :action => 'report' } | |
900 | ) |
|
888 | ) | |
901 | assert_routing( |
|
889 | assert_routing( | |
902 | { :method => 'get', |
|
890 | { :method => 'get', | |
903 | :path => "/projects/567/time_entries/report" }, |
|
891 | :path => "/projects/567/time_entries/report" }, | |
904 | { :controller => 'timelog', :action => 'report', :project_id => '567' } |
|
892 | { :controller => 'timelog', :action => 'report', :project_id => '567' } | |
905 | ) |
|
893 | ) | |
906 | assert_routing( |
|
894 | assert_routing( | |
907 | { :method => 'get', |
|
895 | { :method => 'get', | |
908 | :path => "/projects/567/time_entries/report.csv" }, |
|
896 | :path => "/projects/567/time_entries/report.csv" }, | |
909 | { :controller => 'timelog', :action => 'report', :project_id => '567', |
|
897 | { :controller => 'timelog', :action => 'report', :project_id => '567', | |
910 | :format => 'csv' } |
|
898 | :format => 'csv' } | |
911 | ) |
|
899 | ) | |
912 | end |
|
900 | end | |
913 |
|
901 | |||
914 | def test_users |
|
902 | def test_users | |
915 | assert_routing( |
|
903 | assert_routing( | |
916 | { :method => 'get', :path => "/users" }, |
|
904 | { :method => 'get', :path => "/users" }, | |
917 | { :controller => 'users', :action => 'index' } |
|
905 | { :controller => 'users', :action => 'index' } | |
918 | ) |
|
906 | ) | |
919 | assert_routing( |
|
907 | assert_routing( | |
920 | { :method => 'get', :path => "/users.xml" }, |
|
908 | { :method => 'get', :path => "/users.xml" }, | |
921 | { :controller => 'users', :action => 'index', :format => 'xml' } |
|
909 | { :controller => 'users', :action => 'index', :format => 'xml' } | |
922 | ) |
|
910 | ) | |
923 | assert_routing( |
|
911 | assert_routing( | |
924 | { :method => 'get', :path => "/users/44" }, |
|
912 | { :method => 'get', :path => "/users/44" }, | |
925 | { :controller => 'users', :action => 'show', :id => '44' } |
|
913 | { :controller => 'users', :action => 'show', :id => '44' } | |
926 | ) |
|
914 | ) | |
927 | assert_routing( |
|
915 | assert_routing( | |
928 | { :method => 'get', :path => "/users/44.xml" }, |
|
916 | { :method => 'get', :path => "/users/44.xml" }, | |
929 | { :controller => 'users', :action => 'show', :id => '44', |
|
917 | { :controller => 'users', :action => 'show', :id => '44', | |
930 | :format => 'xml' } |
|
918 | :format => 'xml' } | |
931 | ) |
|
919 | ) | |
932 | assert_routing( |
|
920 | assert_routing( | |
933 | { :method => 'get', :path => "/users/current" }, |
|
921 | { :method => 'get', :path => "/users/current" }, | |
934 | { :controller => 'users', :action => 'show', :id => 'current' } |
|
922 | { :controller => 'users', :action => 'show', :id => 'current' } | |
935 | ) |
|
923 | ) | |
936 | assert_routing( |
|
924 | assert_routing( | |
937 | { :method => 'get', :path => "/users/current.xml" }, |
|
925 | { :method => 'get', :path => "/users/current.xml" }, | |
938 | { :controller => 'users', :action => 'show', :id => 'current', |
|
926 | { :controller => 'users', :action => 'show', :id => 'current', | |
939 | :format => 'xml' } |
|
927 | :format => 'xml' } | |
940 | ) |
|
928 | ) | |
941 | assert_routing( |
|
929 | assert_routing( | |
942 | { :method => 'get', :path => "/users/new" }, |
|
930 | { :method => 'get', :path => "/users/new" }, | |
943 | { :controller => 'users', :action => 'new' } |
|
931 | { :controller => 'users', :action => 'new' } | |
944 | ) |
|
932 | ) | |
945 | assert_routing( |
|
933 | assert_routing( | |
946 | { :method => 'get', :path => "/users/444/edit" }, |
|
934 | { :method => 'get', :path => "/users/444/edit" }, | |
947 | { :controller => 'users', :action => 'edit', :id => '444' } |
|
935 | { :controller => 'users', :action => 'edit', :id => '444' } | |
948 | ) |
|
936 | ) | |
949 | assert_routing( |
|
937 | assert_routing( | |
950 | { :method => 'post', :path => "/users" }, |
|
938 | { :method => 'post', :path => "/users" }, | |
951 | { :controller => 'users', :action => 'create' } |
|
939 | { :controller => 'users', :action => 'create' } | |
952 | ) |
|
940 | ) | |
953 | assert_routing( |
|
941 | assert_routing( | |
954 | { :method => 'post', :path => "/users.xml" }, |
|
942 | { :method => 'post', :path => "/users.xml" }, | |
955 | { :controller => 'users', :action => 'create', :format => 'xml' } |
|
943 | { :controller => 'users', :action => 'create', :format => 'xml' } | |
956 | ) |
|
944 | ) | |
957 | assert_routing( |
|
945 | assert_routing( | |
958 | { :method => 'put', :path => "/users/444" }, |
|
946 | { :method => 'put', :path => "/users/444" }, | |
959 | { :controller => 'users', :action => 'update', :id => '444' } |
|
947 | { :controller => 'users', :action => 'update', :id => '444' } | |
960 | ) |
|
948 | ) | |
961 | assert_routing( |
|
949 | assert_routing( | |
962 | { :method => 'put', :path => "/users/444.xml" }, |
|
950 | { :method => 'put', :path => "/users/444.xml" }, | |
963 | { :controller => 'users', :action => 'update', :id => '444', |
|
951 | { :controller => 'users', :action => 'update', :id => '444', | |
964 | :format => 'xml' } |
|
952 | :format => 'xml' } | |
965 | ) |
|
953 | ) | |
966 | assert_routing( |
|
954 | assert_routing( | |
967 | { :method => 'delete', :path => "/users/44" }, |
|
955 | { :method => 'delete', :path => "/users/44" }, | |
968 | { :controller => 'users', :action => 'destroy', :id => '44' } |
|
956 | { :controller => 'users', :action => 'destroy', :id => '44' } | |
969 | ) |
|
957 | ) | |
970 | assert_routing( |
|
958 | assert_routing( | |
971 | { :method => 'delete', :path => "/users/44.xml" }, |
|
959 | { :method => 'delete', :path => "/users/44.xml" }, | |
972 | { :controller => 'users', :action => 'destroy', :id => '44', |
|
960 | { :controller => 'users', :action => 'destroy', :id => '44', | |
973 | :format => 'xml' } |
|
961 | :format => 'xml' } | |
974 | ) |
|
962 | ) | |
975 | assert_routing( |
|
963 | assert_routing( | |
976 | { :method => 'post', :path => "/users/123/memberships" }, |
|
964 | { :method => 'post', :path => "/users/123/memberships" }, | |
977 | { :controller => 'users', :action => 'edit_membership', |
|
965 | { :controller => 'users', :action => 'edit_membership', | |
978 | :id => '123' } |
|
966 | :id => '123' } | |
979 | ) |
|
967 | ) | |
980 | assert_routing( |
|
968 | assert_routing( | |
981 | { :method => 'put', :path => "/users/123/memberships/55" }, |
|
969 | { :method => 'put', :path => "/users/123/memberships/55" }, | |
982 | { :controller => 'users', :action => 'edit_membership', |
|
970 | { :controller => 'users', :action => 'edit_membership', | |
983 | :id => '123', :membership_id => '55' } |
|
971 | :id => '123', :membership_id => '55' } | |
984 | ) |
|
972 | ) | |
985 | assert_routing( |
|
973 | assert_routing( | |
986 | { :method => 'delete', :path => "/users/123/memberships/55" }, |
|
974 | { :method => 'delete', :path => "/users/123/memberships/55" }, | |
987 | { :controller => 'users', :action => 'destroy_membership', |
|
975 | { :controller => 'users', :action => 'destroy_membership', | |
988 | :id => '123', :membership_id => '55' } |
|
976 | :id => '123', :membership_id => '55' } | |
989 | ) |
|
977 | ) | |
990 | end |
|
978 | end | |
991 |
|
979 | |||
992 | def test_versions |
|
980 | def test_versions | |
993 | # /projects/foo/versions is /projects/foo/roadmap |
|
981 | # /projects/foo/versions is /projects/foo/roadmap | |
994 | assert_routing( |
|
982 | assert_routing( | |
995 | { :method => 'get', :path => "/projects/foo/versions.xml" }, |
|
983 | { :method => 'get', :path => "/projects/foo/versions.xml" }, | |
996 | { :controller => 'versions', :action => 'index', |
|
984 | { :controller => 'versions', :action => 'index', | |
997 | :project_id => 'foo', :format => 'xml' } |
|
985 | :project_id => 'foo', :format => 'xml' } | |
998 | ) |
|
986 | ) | |
999 | assert_routing( |
|
987 | assert_routing( | |
1000 | { :method => 'get', :path => "/projects/foo/versions.json" }, |
|
988 | { :method => 'get', :path => "/projects/foo/versions.json" }, | |
1001 | { :controller => 'versions', :action => 'index', |
|
989 | { :controller => 'versions', :action => 'index', | |
1002 | :project_id => 'foo', :format => 'json' } |
|
990 | :project_id => 'foo', :format => 'json' } | |
1003 | ) |
|
991 | ) | |
1004 | assert_routing( |
|
992 | assert_routing( | |
1005 | { :method => 'get', :path => "/projects/foo/versions/new" }, |
|
993 | { :method => 'get', :path => "/projects/foo/versions/new" }, | |
1006 | { :controller => 'versions', :action => 'new', |
|
994 | { :controller => 'versions', :action => 'new', | |
1007 | :project_id => 'foo' } |
|
995 | :project_id => 'foo' } | |
1008 | ) |
|
996 | ) | |
1009 | assert_routing( |
|
997 | assert_routing( | |
1010 | { :method => 'post', :path => "/projects/foo/versions" }, |
|
998 | { :method => 'post', :path => "/projects/foo/versions" }, | |
1011 | { :controller => 'versions', :action => 'create', |
|
999 | { :controller => 'versions', :action => 'create', | |
1012 | :project_id => 'foo' } |
|
1000 | :project_id => 'foo' } | |
1013 | ) |
|
1001 | ) | |
1014 | assert_routing( |
|
1002 | assert_routing( | |
1015 | { :method => 'post', :path => "/projects/foo/versions.xml" }, |
|
1003 | { :method => 'post', :path => "/projects/foo/versions.xml" }, | |
1016 | { :controller => 'versions', :action => 'create', |
|
1004 | { :controller => 'versions', :action => 'create', | |
1017 | :project_id => 'foo', :format => 'xml' } |
|
1005 | :project_id => 'foo', :format => 'xml' } | |
1018 | ) |
|
1006 | ) | |
1019 | assert_routing( |
|
1007 | assert_routing( | |
1020 | { :method => 'post', :path => "/projects/foo/versions.json" }, |
|
1008 | { :method => 'post', :path => "/projects/foo/versions.json" }, | |
1021 | { :controller => 'versions', :action => 'create', |
|
1009 | { :controller => 'versions', :action => 'create', | |
1022 | :project_id => 'foo', :format => 'json' } |
|
1010 | :project_id => 'foo', :format => 'json' } | |
1023 | ) |
|
1011 | ) | |
1024 | assert_routing( |
|
1012 | assert_routing( | |
1025 | { :method => 'get', :path => "/versions/1" }, |
|
1013 | { :method => 'get', :path => "/versions/1" }, | |
1026 | { :controller => 'versions', :action => 'show', :id => '1' } |
|
1014 | { :controller => 'versions', :action => 'show', :id => '1' } | |
1027 | ) |
|
1015 | ) | |
1028 | assert_routing( |
|
1016 | assert_routing( | |
1029 | { :method => 'get', :path => "/versions/1.xml" }, |
|
1017 | { :method => 'get', :path => "/versions/1.xml" }, | |
1030 | { :controller => 'versions', :action => 'show', :id => '1', |
|
1018 | { :controller => 'versions', :action => 'show', :id => '1', | |
1031 | :format => 'xml' } |
|
1019 | :format => 'xml' } | |
1032 | ) |
|
1020 | ) | |
1033 | assert_routing( |
|
1021 | assert_routing( | |
1034 | { :method => 'get', :path => "/versions/1.json" }, |
|
1022 | { :method => 'get', :path => "/versions/1.json" }, | |
1035 | { :controller => 'versions', :action => 'show', :id => '1', |
|
1023 | { :controller => 'versions', :action => 'show', :id => '1', | |
1036 | :format => 'json' } |
|
1024 | :format => 'json' } | |
1037 | ) |
|
1025 | ) | |
1038 | assert_routing( |
|
1026 | assert_routing( | |
1039 | { :method => 'get', :path => "/versions/1/edit" }, |
|
1027 | { :method => 'get', :path => "/versions/1/edit" }, | |
1040 | { :controller => 'versions', :action => 'edit', :id => '1' } |
|
1028 | { :controller => 'versions', :action => 'edit', :id => '1' } | |
1041 | ) |
|
1029 | ) | |
1042 | assert_routing( |
|
1030 | assert_routing( | |
1043 | { :method => 'put', :path => "/versions/1" }, |
|
1031 | { :method => 'put', :path => "/versions/1" }, | |
1044 | { :controller => 'versions', :action => 'update', :id => '1' } |
|
1032 | { :controller => 'versions', :action => 'update', :id => '1' } | |
1045 | ) |
|
1033 | ) | |
1046 | assert_routing( |
|
1034 | assert_routing( | |
1047 | { :method => 'put', :path => "/versions/1.xml" }, |
|
1035 | { :method => 'put', :path => "/versions/1.xml" }, | |
1048 | { :controller => 'versions', :action => 'update', :id => '1', |
|
1036 | { :controller => 'versions', :action => 'update', :id => '1', | |
1049 | :format => 'xml' } |
|
1037 | :format => 'xml' } | |
1050 | ) |
|
1038 | ) | |
1051 | assert_routing( |
|
1039 | assert_routing( | |
1052 | { :method => 'put', :path => "/versions/1.json" }, |
|
1040 | { :method => 'put', :path => "/versions/1.json" }, | |
1053 | { :controller => 'versions', :action => 'update', :id => '1', |
|
1041 | { :controller => 'versions', :action => 'update', :id => '1', | |
1054 | :format => 'json' } |
|
1042 | :format => 'json' } | |
1055 | ) |
|
1043 | ) | |
1056 | assert_routing( |
|
1044 | assert_routing( | |
1057 | { :method => 'delete', :path => "/versions/1" }, |
|
1045 | { :method => 'delete', :path => "/versions/1" }, | |
1058 | { :controller => 'versions', :action => 'destroy', :id => '1' } |
|
1046 | { :controller => 'versions', :action => 'destroy', :id => '1' } | |
1059 | ) |
|
1047 | ) | |
1060 | assert_routing( |
|
1048 | assert_routing( | |
1061 | { :method => 'delete', :path => "/versions/1.xml" }, |
|
1049 | { :method => 'delete', :path => "/versions/1.xml" }, | |
1062 | { :controller => 'versions', :action => 'destroy', :id => '1', |
|
1050 | { :controller => 'versions', :action => 'destroy', :id => '1', | |
1063 | :format => 'xml' } |
|
1051 | :format => 'xml' } | |
1064 | ) |
|
1052 | ) | |
1065 | assert_routing( |
|
1053 | assert_routing( | |
1066 | { :method => 'delete', :path => "/versions/1.json" }, |
|
1054 | { :method => 'delete', :path => "/versions/1.json" }, | |
1067 | { :controller => 'versions', :action => 'destroy', :id => '1', |
|
1055 | { :controller => 'versions', :action => 'destroy', :id => '1', | |
1068 | :format => 'json' } |
|
1056 | :format => 'json' } | |
1069 | ) |
|
1057 | ) | |
1070 | assert_routing( |
|
1058 | assert_routing( | |
1071 | { :method => 'put', :path => "/projects/foo/versions/close_completed" }, |
|
1059 | { :method => 'put', :path => "/projects/foo/versions/close_completed" }, | |
1072 | { :controller => 'versions', :action => 'close_completed', |
|
1060 | { :controller => 'versions', :action => 'close_completed', | |
1073 | :project_id => 'foo' } |
|
1061 | :project_id => 'foo' } | |
1074 | ) |
|
1062 | ) | |
1075 | assert_routing( |
|
1063 | assert_routing( | |
1076 | { :method => 'post', :path => "/versions/1/status_by" }, |
|
1064 | { :method => 'post', :path => "/versions/1/status_by" }, | |
1077 | { :controller => 'versions', :action => 'status_by', :id => '1' } |
|
1065 | { :controller => 'versions', :action => 'status_by', :id => '1' } | |
1078 | ) |
|
1066 | ) | |
1079 | end |
|
1067 | end | |
1080 |
|
1068 | |||
1081 | def test_welcome |
|
1069 | def test_welcome | |
1082 | assert_routing( |
|
1070 | assert_routing( | |
1083 | { :method => 'get', :path => "/robots.txt" }, |
|
1071 | { :method => 'get', :path => "/robots.txt" }, | |
1084 | { :controller => 'welcome', :action => 'robots' } |
|
1072 | { :controller => 'welcome', :action => 'robots' } | |
1085 | ) |
|
1073 | ) | |
1086 | end |
|
1074 | end | |
1087 |
|
1075 | |||
1088 | def test_wiki_singular_projects_pages |
|
1076 | def test_wiki_singular_projects_pages | |
1089 | assert_routing( |
|
1077 | assert_routing( | |
1090 | { :method => 'get', :path => "/projects/567/wiki" }, |
|
1078 | { :method => 'get', :path => "/projects/567/wiki" }, | |
1091 | { :controller => 'wiki', :action => 'show', :project_id => '567' } |
|
1079 | { :controller => 'wiki', :action => 'show', :project_id => '567' } | |
1092 | ) |
|
1080 | ) | |
1093 | assert_routing( |
|
1081 | assert_routing( | |
1094 | { :method => 'get', :path => "/projects/567/wiki/lalala" }, |
|
1082 | { :method => 'get', :path => "/projects/567/wiki/lalala" }, | |
1095 | { :controller => 'wiki', :action => 'show', :project_id => '567', |
|
1083 | { :controller => 'wiki', :action => 'show', :project_id => '567', | |
1096 | :id => 'lalala' } |
|
1084 | :id => 'lalala' } | |
1097 | ) |
|
1085 | ) | |
1098 | assert_routing( |
|
1086 | assert_routing( | |
1099 | { :method => 'get', :path => "/projects/567/wiki/my_page/edit" }, |
|
1087 | { :method => 'get', :path => "/projects/567/wiki/my_page/edit" }, | |
1100 | { :controller => 'wiki', :action => 'edit', :project_id => '567', |
|
1088 | { :controller => 'wiki', :action => 'edit', :project_id => '567', | |
1101 | :id => 'my_page' } |
|
1089 | :id => 'my_page' } | |
1102 | ) |
|
1090 | ) | |
1103 | assert_routing( |
|
1091 | assert_routing( | |
1104 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" }, |
|
1092 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" }, | |
1105 | { :controller => 'wiki', :action => 'history', :project_id => '1', |
|
1093 | { :controller => 'wiki', :action => 'history', :project_id => '1', | |
1106 | :id => 'CookBook_documentation' } |
|
1094 | :id => 'CookBook_documentation' } | |
1107 | ) |
|
1095 | ) | |
1108 | assert_routing( |
|
1096 | assert_routing( | |
1109 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" }, |
|
1097 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" }, | |
1110 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
1098 | { :controller => 'wiki', :action => 'diff', :project_id => '1', | |
1111 | :id => 'CookBook_documentation' } |
|
1099 | :id => 'CookBook_documentation' } | |
1112 | ) |
|
1100 | ) | |
1113 | assert_routing( |
|
1101 | assert_routing( | |
1114 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" }, |
|
1102 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" }, | |
1115 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
1103 | { :controller => 'wiki', :action => 'diff', :project_id => '1', | |
1116 | :id => 'CookBook_documentation', :version => '2' } |
|
1104 | :id => 'CookBook_documentation', :version => '2' } | |
1117 | ) |
|
1105 | ) | |
1118 | assert_routing( |
|
1106 | assert_routing( | |
1119 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" }, |
|
1107 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" }, | |
1120 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
1108 | { :controller => 'wiki', :action => 'diff', :project_id => '1', | |
1121 | :id => 'CookBook_documentation', :version => '2', :version_from => '1' } |
|
1109 | :id => 'CookBook_documentation', :version => '2', :version_from => '1' } | |
1122 | ) |
|
1110 | ) | |
1123 | assert_routing( |
|
1111 | assert_routing( | |
1124 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" }, |
|
1112 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" }, | |
1125 | { :controller => 'wiki', :action => 'annotate', :project_id => '1', |
|
1113 | { :controller => 'wiki', :action => 'annotate', :project_id => '1', | |
1126 | :id => 'CookBook_documentation', :version => '2' } |
|
1114 | :id => 'CookBook_documentation', :version => '2' } | |
1127 | ) |
|
1115 | ) | |
1128 | assert_routing( |
|
1116 | assert_routing( | |
1129 | { :method => 'get', :path => "/projects/22/wiki/ladida/rename" }, |
|
1117 | { :method => 'get', :path => "/projects/22/wiki/ladida/rename" }, | |
1130 | { :controller => 'wiki', :action => 'rename', :project_id => '22', |
|
1118 | { :controller => 'wiki', :action => 'rename', :project_id => '22', | |
1131 | :id => 'ladida' } |
|
1119 | :id => 'ladida' } | |
1132 | ) |
|
1120 | ) | |
1133 | assert_routing( |
|
1121 | assert_routing( | |
1134 | { :method => 'get', :path => "/projects/567/wiki/index" }, |
|
1122 | { :method => 'get', :path => "/projects/567/wiki/index" }, | |
1135 | { :controller => 'wiki', :action => 'index', :project_id => '567' } |
|
1123 | { :controller => 'wiki', :action => 'index', :project_id => '567' } | |
1136 | ) |
|
1124 | ) | |
1137 | assert_routing( |
|
1125 | assert_routing( | |
1138 | { :method => 'get', :path => "/projects/567/wiki/date_index" }, |
|
1126 | { :method => 'get', :path => "/projects/567/wiki/date_index" }, | |
1139 | { :controller => 'wiki', :action => 'date_index', :project_id => '567' } |
|
1127 | { :controller => 'wiki', :action => 'date_index', :project_id => '567' } | |
1140 | ) |
|
1128 | ) | |
1141 | assert_routing( |
|
1129 | assert_routing( | |
1142 | { :method => 'get', :path => "/projects/567/wiki/export" }, |
|
1130 | { :method => 'get', :path => "/projects/567/wiki/export" }, | |
1143 | { :controller => 'wiki', :action => 'export', :project_id => '567' } |
|
1131 | { :controller => 'wiki', :action => 'export', :project_id => '567' } | |
1144 | ) |
|
1132 | ) | |
1145 | assert_routing( |
|
1133 | assert_routing( | |
1146 | { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" }, |
|
1134 | { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" }, | |
1147 | { :controller => 'wiki', :action => 'preview', :project_id => '567', |
|
1135 | { :controller => 'wiki', :action => 'preview', :project_id => '567', | |
1148 | :id => 'CookBook_documentation' } |
|
1136 | :id => 'CookBook_documentation' } | |
1149 | ) |
|
1137 | ) | |
1150 | assert_routing( |
|
1138 | assert_routing( | |
1151 | { :method => 'post', :path => "/projects/22/wiki/ladida/rename" }, |
|
1139 | { :method => 'post', :path => "/projects/22/wiki/ladida/rename" }, | |
1152 | { :controller => 'wiki', :action => 'rename', :project_id => '22', |
|
1140 | { :controller => 'wiki', :action => 'rename', :project_id => '22', | |
1153 | :id => 'ladida' } |
|
1141 | :id => 'ladida' } | |
1154 | ) |
|
1142 | ) | |
1155 | assert_routing( |
|
1143 | assert_routing( | |
1156 | { :method => 'post', :path => "/projects/22/wiki/ladida/protect" }, |
|
1144 | { :method => 'post', :path => "/projects/22/wiki/ladida/protect" }, | |
1157 | { :controller => 'wiki', :action => 'protect', :project_id => '22', |
|
1145 | { :controller => 'wiki', :action => 'protect', :project_id => '22', | |
1158 | :id => 'ladida' } |
|
1146 | :id => 'ladida' } | |
1159 | ) |
|
1147 | ) | |
1160 | assert_routing( |
|
1148 | assert_routing( | |
1161 | { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" }, |
|
1149 | { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" }, | |
1162 | { :controller => 'wiki', :action => 'add_attachment', :project_id => '22', |
|
1150 | { :controller => 'wiki', :action => 'add_attachment', :project_id => '22', | |
1163 | :id => 'ladida' } |
|
1151 | :id => 'ladida' } | |
1164 | ) |
|
1152 | ) | |
1165 | assert_routing( |
|
1153 | assert_routing( | |
1166 | { :method => 'put', :path => "/projects/567/wiki/my_page" }, |
|
1154 | { :method => 'put', :path => "/projects/567/wiki/my_page" }, | |
1167 | { :controller => 'wiki', :action => 'update', :project_id => '567', |
|
1155 | { :controller => 'wiki', :action => 'update', :project_id => '567', | |
1168 | :id => 'my_page' } |
|
1156 | :id => 'my_page' } | |
1169 | ) |
|
1157 | ) | |
1170 | assert_routing( |
|
1158 | assert_routing( | |
1171 | { :method => 'delete', :path => "/projects/22/wiki/ladida" }, |
|
1159 | { :method => 'delete', :path => "/projects/22/wiki/ladida" }, | |
1172 | { :controller => 'wiki', :action => 'destroy', :project_id => '22', |
|
1160 | { :controller => 'wiki', :action => 'destroy', :project_id => '22', | |
1173 | :id => 'ladida' } |
|
1161 | :id => 'ladida' } | |
1174 | ) |
|
1162 | ) | |
1175 | end |
|
1163 | end | |
1176 |
|
1164 | |||
1177 | def test_wikis_plural_admin_setup |
|
1165 | def test_wikis_plural_admin_setup | |
1178 | assert_routing( |
|
1166 | assert_routing( | |
1179 | { :method => 'get', :path => "/projects/ladida/wiki/destroy" }, |
|
1167 | { :method => 'get', :path => "/projects/ladida/wiki/destroy" }, | |
1180 | { :controller => 'wikis', :action => 'destroy', :id => 'ladida' } |
|
1168 | { :controller => 'wikis', :action => 'destroy', :id => 'ladida' } | |
1181 | ) |
|
1169 | ) | |
1182 | assert_routing( |
|
1170 | assert_routing( | |
1183 | { :method => 'post', :path => "/projects/ladida/wiki" }, |
|
1171 | { :method => 'post', :path => "/projects/ladida/wiki" }, | |
1184 | { :controller => 'wikis', :action => 'edit', :id => 'ladida' } |
|
1172 | { :controller => 'wikis', :action => 'edit', :id => 'ladida' } | |
1185 | ) |
|
1173 | ) | |
1186 | assert_routing( |
|
1174 | assert_routing( | |
1187 | { :method => 'post', :path => "/projects/ladida/wiki/destroy" }, |
|
1175 | { :method => 'post', :path => "/projects/ladida/wiki/destroy" }, | |
1188 | { :controller => 'wikis', :action => 'destroy', :id => 'ladida' } |
|
1176 | { :controller => 'wikis', :action => 'destroy', :id => 'ladida' } | |
1189 | ) |
|
1177 | ) | |
1190 | end |
|
1178 | end | |
1191 | end |
|
1179 | end |
General Comments 0
You need to be logged in to leave comments.
Login now