##// END OF EJS Templates
test: route: move timelogs tests to new file...
Toshi MARUYAMA -
r8223:bc7ed1e15678
parent child
Show More
@@ -0,0 +1,203
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 RoutingTimelogsTest < ActionController::IntegrationTest
21 def test_timelogs_global
22 assert_routing(
23 { :method => 'get', :path => "/time_entries" },
24 { :controller => 'timelog', :action => 'index' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/time_entries.csv" },
28 { :controller => 'timelog', :action => 'index', :format => 'csv' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/time_entries.atom" },
32 { :controller => 'timelog', :action => 'index', :format => 'atom' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/time_entries/new" },
36 { :controller => 'timelog', :action => 'new' }
37 )
38 assert_routing(
39 { :method => 'get', :path => "/time_entries/22/edit" },
40 { :controller => 'timelog', :action => 'edit', :id => '22' }
41 )
42 assert_routing(
43 { :method => 'post', :path => "/time_entries" },
44 { :controller => 'timelog', :action => 'create' }
45 )
46 assert_routing(
47 { :method => 'put', :path => "/time_entries/22" },
48 { :controller => 'timelog', :action => 'update', :id => '22' }
49 )
50 assert_routing(
51 { :method => 'delete', :path => "/time_entries/55" },
52 { :controller => 'timelog', :action => 'destroy', :id => '55' }
53 )
54 end
55
56 def test_timelogs_scoped_under_project
57 assert_routing(
58 { :method => 'get', :path => "/projects/567/time_entries" },
59 { :controller => 'timelog', :action => 'index', :project_id => '567' }
60 )
61 assert_routing(
62 { :method => 'get', :path => "/projects/567/time_entries.csv" },
63 { :controller => 'timelog', :action => 'index', :project_id => '567',
64 :format => 'csv' }
65 )
66 assert_routing(
67 { :method => 'get', :path => "/projects/567/time_entries.atom" },
68 { :controller => 'timelog', :action => 'index', :project_id => '567',
69 :format => 'atom' }
70 )
71 assert_routing(
72 { :method => 'get', :path => "/projects/567/time_entries/new" },
73 { :controller => 'timelog', :action => 'new', :project_id => '567' }
74 )
75 assert_routing(
76 { :method => 'get', :path => "/projects/567/time_entries/22/edit" },
77 { :controller => 'timelog', :action => 'edit',
78 :id => '22', :project_id => '567' }
79 )
80 assert_routing(
81 { :method => 'post', :path => "/projects/567/time_entries" },
82 { :controller => 'timelog', :action => 'create',
83 :project_id => '567' }
84 )
85 assert_routing(
86 { :method => 'put', :path => "/projects/567/time_entries/22" },
87 { :controller => 'timelog', :action => 'update',
88 :id => '22', :project_id => '567' }
89 )
90 assert_routing(
91 { :method => 'delete', :path => "/projects/567/time_entries/55" },
92 { :controller => 'timelog', :action => 'destroy',
93 :id => '55', :project_id => '567' }
94 )
95 end
96
97 def test_timelogs_scoped_under_issues
98 assert_routing(
99 { :method => 'get', :path => "/issues/234/time_entries" },
100 { :controller => 'timelog', :action => 'index', :issue_id => '234' }
101 )
102 assert_routing(
103 { :method => 'get', :path => "/issues/234/time_entries.csv" },
104 { :controller => 'timelog', :action => 'index', :issue_id => '234',
105 :format => 'csv' }
106 )
107 assert_routing(
108 { :method => 'get', :path => "/issues/234/time_entries.atom" },
109 { :controller => 'timelog', :action => 'index', :issue_id => '234',
110 :format => 'atom' }
111 )
112 assert_routing(
113 { :method => 'get', :path => "/issues/234/time_entries/new" },
114 { :controller => 'timelog', :action => 'new', :issue_id => '234' }
115 )
116 assert_routing(
117 { :method => 'get', :path => "/issues/234/time_entries/22/edit" },
118 { :controller => 'timelog', :action => 'edit', :id => '22',
119 :issue_id => '234' }
120 )
121 assert_routing(
122 { :method => 'post', :path => "/issues/234/time_entries" },
123 { :controller => 'timelog', :action => 'create', :issue_id => '234' }
124 )
125 assert_routing(
126 { :method => 'put', :path => "/issues/234/time_entries/22" },
127 { :controller => 'timelog', :action => 'update', :id => '22',
128 :issue_id => '234' }
129 )
130 assert_routing(
131 { :method => 'delete', :path => "/issues/234/time_entries/55" },
132 { :controller => 'timelog', :action => 'destroy', :id => '55',
133 :issue_id => '234' }
134 )
135 end
136
137 def test_timelogs_scoped_under_project_and_issues
138 assert_routing(
139 { :method => 'get',
140 :path => "/projects/ecookbook/issues/234/time_entries" },
141 { :controller => 'timelog', :action => 'index',
142 :issue_id => '234', :project_id => 'ecookbook' }
143 )
144 assert_routing(
145 { :method => 'get',
146 :path => "/projects/ecookbook/issues/234/time_entries.csv" },
147 { :controller => 'timelog', :action => 'index',
148 :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' }
149 )
150 assert_routing(
151 { :method => 'get',
152 :path => "/projects/ecookbook/issues/234/time_entries.atom" },
153 { :controller => 'timelog', :action => 'index',
154 :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' }
155 )
156 assert_routing(
157 { :method => 'get',
158 :path => "/projects/ecookbook/issues/234/time_entries/new" },
159 { :controller => 'timelog', :action => 'new',
160 :issue_id => '234', :project_id => 'ecookbook' }
161 )
162 assert_routing(
163 { :method => 'get',
164 :path => "/projects/ecookbook/issues/234/time_entries/22/edit" },
165 { :controller => 'timelog', :action => 'edit', :id => '22',
166 :issue_id => '234', :project_id => 'ecookbook' }
167 )
168 assert_routing(
169 { :method => 'post',
170 :path => "/projects/ecookbook/issues/234/time_entries" },
171 { :controller => 'timelog', :action => 'create',
172 :issue_id => '234', :project_id => 'ecookbook' }
173 )
174 assert_routing(
175 { :method => 'put',
176 :path => "/projects/ecookbook/issues/234/time_entries/22" },
177 { :controller => 'timelog', :action => 'update', :id => '22',
178 :issue_id => '234', :project_id => 'ecookbook' }
179 )
180 assert_routing(
181 { :method => 'delete',
182 :path => "/projects/ecookbook/issues/234/time_entries/55" },
183 { :controller => 'timelog', :action => 'destroy', :id => '55',
184 :issue_id => '234', :project_id => 'ecookbook' }
185 )
186 assert_routing(
187 { :method => 'get',
188 :path => "/time_entries/report" },
189 { :controller => 'timelog', :action => 'report' }
190 )
191 assert_routing(
192 { :method => 'get',
193 :path => "/projects/567/time_entries/report" },
194 { :controller => 'timelog', :action => 'report', :project_id => '567' }
195 )
196 assert_routing(
197 { :method => 'get',
198 :path => "/projects/567/time_entries/report.csv" },
199 { :controller => 'timelog', :action => 'report', :project_id => '567',
200 :format => 'csv' }
201 )
202 end
203 end
@@ -1,849 +1,666
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_issues_rest_actions
21 def test_issues_rest_actions
22 assert_routing(
22 assert_routing(
23 { :method => 'get', :path => "/issues" },
23 { :method => 'get', :path => "/issues" },
24 { :controller => 'issues', :action => 'index' }
24 { :controller => 'issues', :action => 'index' }
25 )
25 )
26 assert_routing(
26 assert_routing(
27 { :method => 'get', :path => "/issues.pdf" },
27 { :method => 'get', :path => "/issues.pdf" },
28 { :controller => 'issues', :action => 'index', :format => 'pdf' }
28 { :controller => 'issues', :action => 'index', :format => 'pdf' }
29 )
29 )
30 assert_routing(
30 assert_routing(
31 { :method => 'get', :path => "/issues.atom" },
31 { :method => 'get', :path => "/issues.atom" },
32 { :controller => 'issues', :action => 'index', :format => 'atom' }
32 { :controller => 'issues', :action => 'index', :format => 'atom' }
33 )
33 )
34 assert_routing(
34 assert_routing(
35 { :method => 'get', :path => "/issues.xml" },
35 { :method => 'get', :path => "/issues.xml" },
36 { :controller => 'issues', :action => 'index', :format => 'xml' }
36 { :controller => 'issues', :action => 'index', :format => 'xml' }
37 )
37 )
38 assert_routing(
38 assert_routing(
39 { :method => 'get', :path => "/projects/23/issues" },
39 { :method => 'get', :path => "/projects/23/issues" },
40 { :controller => 'issues', :action => 'index', :project_id => '23' }
40 { :controller => 'issues', :action => 'index', :project_id => '23' }
41 )
41 )
42 assert_routing(
42 assert_routing(
43 { :method => 'get', :path => "/projects/23/issues.pdf" },
43 { :method => 'get', :path => "/projects/23/issues.pdf" },
44 { :controller => 'issues', :action => 'index', :project_id => '23',
44 { :controller => 'issues', :action => 'index', :project_id => '23',
45 :format => 'pdf' }
45 :format => 'pdf' }
46 )
46 )
47 assert_routing(
47 assert_routing(
48 { :method => 'get', :path => "/projects/23/issues.atom" },
48 { :method => 'get', :path => "/projects/23/issues.atom" },
49 { :controller => 'issues', :action => 'index', :project_id => '23',
49 { :controller => 'issues', :action => 'index', :project_id => '23',
50 :format => 'atom' }
50 :format => 'atom' }
51 )
51 )
52 assert_routing(
52 assert_routing(
53 { :method => 'get', :path => "/projects/23/issues.xml" },
53 { :method => 'get', :path => "/projects/23/issues.xml" },
54 { :controller => 'issues', :action => 'index', :project_id => '23',
54 { :controller => 'issues', :action => 'index', :project_id => '23',
55 :format => 'xml' }
55 :format => 'xml' }
56 )
56 )
57 assert_routing(
57 assert_routing(
58 { :method => 'get', :path => "/issues/64" },
58 { :method => 'get', :path => "/issues/64" },
59 { :controller => 'issues', :action => 'show', :id => '64' }
59 { :controller => 'issues', :action => 'show', :id => '64' }
60 )
60 )
61 assert_routing(
61 assert_routing(
62 { :method => 'get', :path => "/issues/64.pdf" },
62 { :method => 'get', :path => "/issues/64.pdf" },
63 { :controller => 'issues', :action => 'show', :id => '64',
63 { :controller => 'issues', :action => 'show', :id => '64',
64 :format => 'pdf' }
64 :format => 'pdf' }
65 )
65 )
66 assert_routing(
66 assert_routing(
67 { :method => 'get', :path => "/issues/64.atom" },
67 { :method => 'get', :path => "/issues/64.atom" },
68 { :controller => 'issues', :action => 'show', :id => '64',
68 { :controller => 'issues', :action => 'show', :id => '64',
69 :format => 'atom' }
69 :format => 'atom' }
70 )
70 )
71 assert_routing(
71 assert_routing(
72 { :method => 'get', :path => "/issues/64.xml" },
72 { :method => 'get', :path => "/issues/64.xml" },
73 { :controller => 'issues', :action => 'show', :id => '64',
73 { :controller => 'issues', :action => 'show', :id => '64',
74 :format => 'xml' }
74 :format => 'xml' }
75 )
75 )
76 assert_routing(
76 assert_routing(
77 { :method => 'get', :path => "/projects/23/issues/new" },
77 { :method => 'get', :path => "/projects/23/issues/new" },
78 { :controller => 'issues', :action => 'new', :project_id => '23' }
78 { :controller => 'issues', :action => 'new', :project_id => '23' }
79 )
79 )
80 end
80 end
81
81
82 def test_issues_form_update
82 def test_issues_form_update
83 assert_routing(
83 assert_routing(
84 { :method => 'post', :path => "/projects/23/issues/new" },
84 { :method => 'post', :path => "/projects/23/issues/new" },
85 { :controller => 'issues', :action => 'new', :project_id => '23' }
85 { :controller => 'issues', :action => 'new', :project_id => '23' }
86 )
86 )
87 assert_routing(
87 assert_routing(
88 { :method => 'post', :path => "/projects/23/issues" },
88 { :method => 'post', :path => "/projects/23/issues" },
89 { :controller => 'issues', :action => 'create', :project_id => '23' }
89 { :controller => 'issues', :action => 'create', :project_id => '23' }
90 )
90 )
91 assert_routing(
91 assert_routing(
92 { :method => 'post', :path => "/issues.xml" },
92 { :method => 'post', :path => "/issues.xml" },
93 { :controller => 'issues', :action => 'create', :format => 'xml' }
93 { :controller => 'issues', :action => 'create', :format => 'xml' }
94 )
94 )
95 assert_routing(
95 assert_routing(
96 { :method => 'get', :path => "/issues/64/edit" },
96 { :method => 'get', :path => "/issues/64/edit" },
97 { :controller => 'issues', :action => 'edit', :id => '64' }
97 { :controller => 'issues', :action => 'edit', :id => '64' }
98 )
98 )
99 assert_routing(
99 assert_routing(
100 { :method => 'put', :path => "/issues/1.xml" },
100 { :method => 'put', :path => "/issues/1.xml" },
101 { :controller => 'issues', :action => 'update', :id => '1',
101 { :controller => 'issues', :action => 'update', :id => '1',
102 :format => 'xml' }
102 :format => 'xml' }
103 )
103 )
104 assert_routing(
104 assert_routing(
105 { :method => 'delete', :path => "/issues/1.xml" },
105 { :method => 'delete', :path => "/issues/1.xml" },
106 { :controller => 'issues', :action => 'destroy', :id => '1',
106 { :controller => 'issues', :action => 'destroy', :id => '1',
107 :format => 'xml' }
107 :format => 'xml' }
108 )
108 )
109 end
109 end
110
110
111 def test_issues_extra_actions
111 def test_issues_extra_actions
112 assert_routing(
112 assert_routing(
113 { :method => 'get', :path => "/projects/23/issues/64/copy" },
113 { :method => 'get', :path => "/projects/23/issues/64/copy" },
114 { :controller => 'issues', :action => 'new', :project_id => '23',
114 { :controller => 'issues', :action => 'new', :project_id => '23',
115 :copy_from => '64' }
115 :copy_from => '64' }
116 )
116 )
117 assert_routing(
117 assert_routing(
118 { :method => 'get', :path => "/issues/auto_complete" },
118 { :method => 'get', :path => "/issues/auto_complete" },
119 { :controller => 'auto_completes', :action => 'issues' }
119 { :controller => 'auto_completes', :action => 'issues' }
120 )
120 )
121 assert_routing(
121 assert_routing(
122 { :method => 'get', :path => "/issues/preview/123" },
122 { :method => 'get', :path => "/issues/preview/123" },
123 { :controller => 'previews', :action => 'issue', :id => '123' }
123 { :controller => 'previews', :action => 'issue', :id => '123' }
124 )
124 )
125 assert_routing(
125 assert_routing(
126 { :method => 'post', :path => "/issues/preview/123" },
126 { :method => 'post', :path => "/issues/preview/123" },
127 { :controller => 'previews', :action => 'issue', :id => '123' }
127 { :controller => 'previews', :action => 'issue', :id => '123' }
128 )
128 )
129 assert_routing(
129 assert_routing(
130 { :method => 'get', :path => "/issues/context_menu" },
130 { :method => 'get', :path => "/issues/context_menu" },
131 { :controller => 'context_menus', :action => 'issues' }
131 { :controller => 'context_menus', :action => 'issues' }
132 )
132 )
133 assert_routing(
133 assert_routing(
134 { :method => 'post', :path => "/issues/context_menu" },
134 { :method => 'post', :path => "/issues/context_menu" },
135 { :controller => 'context_menus', :action => 'issues' }
135 { :controller => 'context_menus', :action => 'issues' }
136 )
136 )
137 assert_routing(
137 assert_routing(
138 { :method => 'get', :path => "/issues/bulk_edit" },
138 { :method => 'get', :path => "/issues/bulk_edit" },
139 { :controller => 'issues', :action => 'bulk_edit' }
139 { :controller => 'issues', :action => 'bulk_edit' }
140 )
140 )
141 assert_routing(
141 assert_routing(
142 { :method => 'post', :path => "/issues/bulk_update" },
142 { :method => 'post', :path => "/issues/bulk_update" },
143 { :controller => 'issues', :action => 'bulk_update' }
143 { :controller => 'issues', :action => 'bulk_update' }
144 )
144 )
145 end
145 end
146
146
147 def test_issue_categories
147 def test_issue_categories
148 assert_routing(
148 assert_routing(
149 { :method => 'get', :path => "/projects/foo/issue_categories" },
149 { :method => 'get', :path => "/projects/foo/issue_categories" },
150 { :controller => 'issue_categories', :action => 'index',
150 { :controller => 'issue_categories', :action => 'index',
151 :project_id => 'foo' }
151 :project_id => 'foo' }
152 )
152 )
153 assert_routing(
153 assert_routing(
154 { :method => 'get', :path => "/projects/foo/issue_categories.xml" },
154 { :method => 'get', :path => "/projects/foo/issue_categories.xml" },
155 { :controller => 'issue_categories', :action => 'index',
155 { :controller => 'issue_categories', :action => 'index',
156 :project_id => 'foo', :format => 'xml' }
156 :project_id => 'foo', :format => 'xml' }
157 )
157 )
158 assert_routing(
158 assert_routing(
159 { :method => 'get', :path => "/projects/foo/issue_categories.json" },
159 { :method => 'get', :path => "/projects/foo/issue_categories.json" },
160 { :controller => 'issue_categories', :action => 'index',
160 { :controller => 'issue_categories', :action => 'index',
161 :project_id => 'foo', :format => 'json' }
161 :project_id => 'foo', :format => 'json' }
162 )
162 )
163 assert_routing(
163 assert_routing(
164 { :method => 'get', :path => "/projects/foo/issue_categories/new" },
164 { :method => 'get', :path => "/projects/foo/issue_categories/new" },
165 { :controller => 'issue_categories', :action => 'new',
165 { :controller => 'issue_categories', :action => 'new',
166 :project_id => 'foo' }
166 :project_id => 'foo' }
167 )
167 )
168 assert_routing(
168 assert_routing(
169 { :method => 'post', :path => "/projects/foo/issue_categories" },
169 { :method => 'post', :path => "/projects/foo/issue_categories" },
170 { :controller => 'issue_categories', :action => 'create',
170 { :controller => 'issue_categories', :action => 'create',
171 :project_id => 'foo' }
171 :project_id => 'foo' }
172 )
172 )
173 assert_routing(
173 assert_routing(
174 { :method => 'post', :path => "/projects/foo/issue_categories.xml" },
174 { :method => 'post', :path => "/projects/foo/issue_categories.xml" },
175 { :controller => 'issue_categories', :action => 'create',
175 { :controller => 'issue_categories', :action => 'create',
176 :project_id => 'foo', :format => 'xml' }
176 :project_id => 'foo', :format => 'xml' }
177 )
177 )
178 assert_routing(
178 assert_routing(
179 { :method => 'post', :path => "/projects/foo/issue_categories.json" },
179 { :method => 'post', :path => "/projects/foo/issue_categories.json" },
180 { :controller => 'issue_categories', :action => 'create',
180 { :controller => 'issue_categories', :action => 'create',
181 :project_id => 'foo', :format => 'json' }
181 :project_id => 'foo', :format => 'json' }
182 )
182 )
183 assert_routing(
183 assert_routing(
184 { :method => 'get', :path => "/issue_categories/1" },
184 { :method => 'get', :path => "/issue_categories/1" },
185 { :controller => 'issue_categories', :action => 'show', :id => '1' }
185 { :controller => 'issue_categories', :action => 'show', :id => '1' }
186 )
186 )
187 assert_routing(
187 assert_routing(
188 { :method => 'get', :path => "/issue_categories/1.xml" },
188 { :method => 'get', :path => "/issue_categories/1.xml" },
189 { :controller => 'issue_categories', :action => 'show', :id => '1',
189 { :controller => 'issue_categories', :action => 'show', :id => '1',
190 :format => 'xml' }
190 :format => 'xml' }
191 )
191 )
192 assert_routing(
192 assert_routing(
193 { :method => 'get', :path => "/issue_categories/1.json" },
193 { :method => 'get', :path => "/issue_categories/1.json" },
194 { :controller => 'issue_categories', :action => 'show', :id => '1',
194 { :controller => 'issue_categories', :action => 'show', :id => '1',
195 :format => 'json' }
195 :format => 'json' }
196 )
196 )
197 assert_routing(
197 assert_routing(
198 { :method => 'get', :path => "/issue_categories/1/edit" },
198 { :method => 'get', :path => "/issue_categories/1/edit" },
199 { :controller => 'issue_categories', :action => 'edit', :id => '1' }
199 { :controller => 'issue_categories', :action => 'edit', :id => '1' }
200 )
200 )
201 assert_routing(
201 assert_routing(
202 { :method => 'put', :path => "/issue_categories/1" },
202 { :method => 'put', :path => "/issue_categories/1" },
203 { :controller => 'issue_categories', :action => 'update', :id => '1' }
203 { :controller => 'issue_categories', :action => 'update', :id => '1' }
204 )
204 )
205 assert_routing(
205 assert_routing(
206 { :method => 'put', :path => "/issue_categories/1.xml" },
206 { :method => 'put', :path => "/issue_categories/1.xml" },
207 { :controller => 'issue_categories', :action => 'update', :id => '1',
207 { :controller => 'issue_categories', :action => 'update', :id => '1',
208 :format => 'xml' }
208 :format => 'xml' }
209 )
209 )
210 assert_routing(
210 assert_routing(
211 { :method => 'put', :path => "/issue_categories/1.json" },
211 { :method => 'put', :path => "/issue_categories/1.json" },
212 { :controller => 'issue_categories', :action => 'update', :id => '1',
212 { :controller => 'issue_categories', :action => 'update', :id => '1',
213 :format => 'json' }
213 :format => 'json' }
214 )
214 )
215 assert_routing(
215 assert_routing(
216 { :method => 'delete', :path => "/issue_categories/1" },
216 { :method => 'delete', :path => "/issue_categories/1" },
217 { :controller => 'issue_categories', :action => 'destroy', :id => '1' }
217 { :controller => 'issue_categories', :action => 'destroy', :id => '1' }
218 )
218 )
219 assert_routing(
219 assert_routing(
220 { :method => 'delete', :path => "/issue_categories/1.xml" },
220 { :method => 'delete', :path => "/issue_categories/1.xml" },
221 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
221 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
222 :format => 'xml' }
222 :format => 'xml' }
223 )
223 )
224 assert_routing(
224 assert_routing(
225 { :method => 'delete', :path => "/issue_categories/1.json" },
225 { :method => 'delete', :path => "/issue_categories/1.json" },
226 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
226 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
227 :format => 'json' }
227 :format => 'json' }
228 )
228 )
229 end
229 end
230
230
231 def test_news
231 def test_news
232 assert_routing(
232 assert_routing(
233 { :method => 'get', :path => "/news" },
233 { :method => 'get', :path => "/news" },
234 { :controller => 'news', :action => 'index' }
234 { :controller => 'news', :action => 'index' }
235 )
235 )
236 assert_routing(
236 assert_routing(
237 { :method => 'get', :path => "/news.atom" },
237 { :method => 'get', :path => "/news.atom" },
238 { :controller => 'news', :action => 'index', :format => 'atom' }
238 { :controller => 'news', :action => 'index', :format => 'atom' }
239 )
239 )
240 assert_routing(
240 assert_routing(
241 { :method => 'get', :path => "/news.xml" },
241 { :method => 'get', :path => "/news.xml" },
242 { :controller => 'news', :action => 'index', :format => 'xml' }
242 { :controller => 'news', :action => 'index', :format => 'xml' }
243 )
243 )
244 assert_routing(
244 assert_routing(
245 { :method => 'get', :path => "/news.json" },
245 { :method => 'get', :path => "/news.json" },
246 { :controller => 'news', :action => 'index', :format => 'json' }
246 { :controller => 'news', :action => 'index', :format => 'json' }
247 )
247 )
248 assert_routing(
248 assert_routing(
249 { :method => 'get', :path => "/projects/567/news" },
249 { :method => 'get', :path => "/projects/567/news" },
250 { :controller => 'news', :action => 'index', :project_id => '567' }
250 { :controller => 'news', :action => 'index', :project_id => '567' }
251 )
251 )
252 assert_routing(
252 assert_routing(
253 { :method => 'get', :path => "/projects/567/news.atom" },
253 { :method => 'get', :path => "/projects/567/news.atom" },
254 { :controller => 'news', :action => 'index', :format => 'atom',
254 { :controller => 'news', :action => 'index', :format => 'atom',
255 :project_id => '567' }
255 :project_id => '567' }
256 )
256 )
257 assert_routing(
257 assert_routing(
258 { :method => 'get', :path => "/projects/567/news.xml" },
258 { :method => 'get', :path => "/projects/567/news.xml" },
259 { :controller => 'news', :action => 'index', :format => 'xml',
259 { :controller => 'news', :action => 'index', :format => 'xml',
260 :project_id => '567' }
260 :project_id => '567' }
261 )
261 )
262 assert_routing(
262 assert_routing(
263 { :method => 'get', :path => "/projects/567/news.json" },
263 { :method => 'get', :path => "/projects/567/news.json" },
264 { :controller => 'news', :action => 'index', :format => 'json',
264 { :controller => 'news', :action => 'index', :format => 'json',
265 :project_id => '567' }
265 :project_id => '567' }
266 )
266 )
267 assert_routing(
267 assert_routing(
268 { :method => 'get', :path => "/news/2" },
268 { :method => 'get', :path => "/news/2" },
269 { :controller => 'news', :action => 'show', :id => '2' }
269 { :controller => 'news', :action => 'show', :id => '2' }
270 )
270 )
271 assert_routing(
271 assert_routing(
272 { :method => 'get', :path => "/projects/567/news/new" },
272 { :method => 'get', :path => "/projects/567/news/new" },
273 { :controller => 'news', :action => 'new', :project_id => '567' }
273 { :controller => 'news', :action => 'new', :project_id => '567' }
274 )
274 )
275 assert_routing(
275 assert_routing(
276 { :method => 'get', :path => "/news/234" },
276 { :method => 'get', :path => "/news/234" },
277 { :controller => 'news', :action => 'show', :id => '234' }
277 { :controller => 'news', :action => 'show', :id => '234' }
278 )
278 )
279 assert_routing(
279 assert_routing(
280 { :method => 'get', :path => "/news/567/edit" },
280 { :method => 'get', :path => "/news/567/edit" },
281 { :controller => 'news', :action => 'edit', :id => '567' }
281 { :controller => 'news', :action => 'edit', :id => '567' }
282 )
282 )
283 assert_routing(
283 assert_routing(
284 { :method => 'get', :path => "/news/preview" },
284 { :method => 'get', :path => "/news/preview" },
285 { :controller => 'previews', :action => 'news' }
285 { :controller => 'previews', :action => 'news' }
286 )
286 )
287 assert_routing(
287 assert_routing(
288 { :method => 'post', :path => "/projects/567/news" },
288 { :method => 'post', :path => "/projects/567/news" },
289 { :controller => 'news', :action => 'create', :project_id => '567' }
289 { :controller => 'news', :action => 'create', :project_id => '567' }
290 )
290 )
291 assert_routing(
291 assert_routing(
292 { :method => 'post', :path => "/news/567/comments" },
292 { :method => 'post', :path => "/news/567/comments" },
293 { :controller => 'comments', :action => 'create', :id => '567' }
293 { :controller => 'comments', :action => 'create', :id => '567' }
294 )
294 )
295 assert_routing(
295 assert_routing(
296 { :method => 'put', :path => "/news/567" },
296 { :method => 'put', :path => "/news/567" },
297 { :controller => 'news', :action => 'update', :id => '567' }
297 { :controller => 'news', :action => 'update', :id => '567' }
298 )
298 )
299 assert_routing(
299 assert_routing(
300 { :method => 'delete', :path => "/news/567" },
300 { :method => 'delete', :path => "/news/567" },
301 { :controller => 'news', :action => 'destroy', :id => '567' }
301 { :controller => 'news', :action => 'destroy', :id => '567' }
302 )
302 )
303 assert_routing(
303 assert_routing(
304 { :method => 'delete', :path => "/news/567/comments/15" },
304 { :method => 'delete', :path => "/news/567/comments/15" },
305 { :controller => 'comments', :action => 'destroy', :id => '567',
305 { :controller => 'comments', :action => 'destroy', :id => '567',
306 :comment_id => '15' }
306 :comment_id => '15' }
307 )
307 )
308 end
308 end
309
309
310 def test_projects
310 def test_projects
311 assert_routing(
311 assert_routing(
312 { :method => 'get', :path => "/projects" },
312 { :method => 'get', :path => "/projects" },
313 { :controller => 'projects', :action => 'index' }
313 { :controller => 'projects', :action => 'index' }
314 )
314 )
315 assert_routing(
315 assert_routing(
316 { :method => 'get', :path => "/projects.atom" },
316 { :method => 'get', :path => "/projects.atom" },
317 { :controller => 'projects', :action => 'index', :format => 'atom' }
317 { :controller => 'projects', :action => 'index', :format => 'atom' }
318 )
318 )
319 assert_routing(
319 assert_routing(
320 { :method => 'get', :path => "/projects.xml" },
320 { :method => 'get', :path => "/projects.xml" },
321 { :controller => 'projects', :action => 'index', :format => 'xml' }
321 { :controller => 'projects', :action => 'index', :format => 'xml' }
322 )
322 )
323 assert_routing(
323 assert_routing(
324 { :method => 'get', :path => "/projects/new" },
324 { :method => 'get', :path => "/projects/new" },
325 { :controller => 'projects', :action => 'new' }
325 { :controller => 'projects', :action => 'new' }
326 )
326 )
327 assert_routing(
327 assert_routing(
328 { :method => 'get', :path => "/projects/test" },
328 { :method => 'get', :path => "/projects/test" },
329 { :controller => 'projects', :action => 'show', :id => 'test' }
329 { :controller => 'projects', :action => 'show', :id => 'test' }
330 )
330 )
331 assert_routing(
331 assert_routing(
332 { :method => 'get', :path => "/projects/1.xml" },
332 { :method => 'get', :path => "/projects/1.xml" },
333 { :controller => 'projects', :action => 'show', :id => '1',
333 { :controller => 'projects', :action => 'show', :id => '1',
334 :format => 'xml' }
334 :format => 'xml' }
335 )
335 )
336 assert_routing(
336 assert_routing(
337 { :method => 'get', :path => "/projects/4223/settings" },
337 { :method => 'get', :path => "/projects/4223/settings" },
338 { :controller => 'projects', :action => 'settings', :id => '4223' }
338 { :controller => 'projects', :action => 'settings', :id => '4223' }
339 )
339 )
340 assert_routing(
340 assert_routing(
341 { :method => 'get', :path => "/projects/4223/settings/members" },
341 { :method => 'get', :path => "/projects/4223/settings/members" },
342 { :controller => 'projects', :action => 'settings', :id => '4223',
342 { :controller => 'projects', :action => 'settings', :id => '4223',
343 :tab => 'members' }
343 :tab => 'members' }
344 )
344 )
345 assert_routing(
345 assert_routing(
346 { :method => 'get', :path => "/projects/33/roadmap" },
346 { :method => 'get', :path => "/projects/33/roadmap" },
347 { :controller => 'versions', :action => 'index', :project_id => '33' }
347 { :controller => 'versions', :action => 'index', :project_id => '33' }
348 )
348 )
349 assert_routing(
349 assert_routing(
350 { :method => 'get', :path => "/projects/33/activity" },
350 { :method => 'get', :path => "/projects/33/activity" },
351 { :controller => 'activities', :action => 'index', :id => '33' }
351 { :controller => 'activities', :action => 'index', :id => '33' }
352 )
352 )
353 assert_routing(
353 assert_routing(
354 { :method => 'get', :path => "/projects/33/activity.atom" },
354 { :method => 'get', :path => "/projects/33/activity.atom" },
355 { :controller => 'activities', :action => 'index', :id => '33',
355 { :controller => 'activities', :action => 'index', :id => '33',
356 :format => 'atom' }
356 :format => 'atom' }
357 )
357 )
358 assert_routing(
358 assert_routing(
359 { :method => 'post', :path => "/projects" },
359 { :method => 'post', :path => "/projects" },
360 { :controller => 'projects', :action => 'create' }
360 { :controller => 'projects', :action => 'create' }
361 )
361 )
362 assert_routing(
362 assert_routing(
363 { :method => 'post', :path => "/projects.xml" },
363 { :method => 'post', :path => "/projects.xml" },
364 { :controller => 'projects', :action => 'create', :format => 'xml' }
364 { :controller => 'projects', :action => 'create', :format => 'xml' }
365 )
365 )
366 assert_routing(
366 assert_routing(
367 { :method => 'post', :path => "/projects/64/archive" },
367 { :method => 'post', :path => "/projects/64/archive" },
368 { :controller => 'projects', :action => 'archive', :id => '64' }
368 { :controller => 'projects', :action => 'archive', :id => '64' }
369 )
369 )
370 assert_routing(
370 assert_routing(
371 { :method => 'post', :path => "/projects/64/unarchive" },
371 { :method => 'post', :path => "/projects/64/unarchive" },
372 { :controller => 'projects', :action => 'unarchive', :id => '64' }
372 { :controller => 'projects', :action => 'unarchive', :id => '64' }
373 )
373 )
374 assert_routing(
374 assert_routing(
375 { :method => 'put', :path => "/projects/64/enumerations" },
375 { :method => 'put', :path => "/projects/64/enumerations" },
376 { :controller => 'project_enumerations', :action => 'update',
376 { :controller => 'project_enumerations', :action => 'update',
377 :project_id => '64' }
377 :project_id => '64' }
378 )
378 )
379 assert_routing(
379 assert_routing(
380 { :method => 'put', :path => "/projects/4223" },
380 { :method => 'put', :path => "/projects/4223" },
381 { :controller => 'projects', :action => 'update', :id => '4223' }
381 { :controller => 'projects', :action => 'update', :id => '4223' }
382 )
382 )
383 assert_routing(
383 assert_routing(
384 { :method => 'put', :path => "/projects/1.xml" },
384 { :method => 'put', :path => "/projects/1.xml" },
385 { :controller => 'projects', :action => 'update', :id => '1',
385 { :controller => 'projects', :action => 'update', :id => '1',
386 :format => 'xml' }
386 :format => 'xml' }
387 )
387 )
388 assert_routing(
388 assert_routing(
389 { :method => 'delete', :path => "/projects/64" },
389 { :method => 'delete', :path => "/projects/64" },
390 { :controller => 'projects', :action => 'destroy', :id => '64' }
390 { :controller => 'projects', :action => 'destroy', :id => '64' }
391 )
391 )
392 assert_routing(
392 assert_routing(
393 { :method => 'delete', :path => "/projects/1.xml" },
393 { :method => 'delete', :path => "/projects/1.xml" },
394 { :controller => 'projects', :action => 'destroy', :id => '1',
394 { :controller => 'projects', :action => 'destroy', :id => '1',
395 :format => 'xml' }
395 :format => 'xml' }
396 )
396 )
397 assert_routing(
397 assert_routing(
398 { :method => 'delete', :path => "/projects/64/enumerations" },
398 { :method => 'delete', :path => "/projects/64/enumerations" },
399 { :controller => 'project_enumerations', :action => 'destroy',
399 { :controller => 'project_enumerations', :action => 'destroy',
400 :project_id => '64' }
400 :project_id => '64' }
401 )
401 )
402 end
402 end
403
403
404 def test_queries
404 def test_queries
405 assert_routing(
405 assert_routing(
406 { :method => 'get', :path => "/queries.xml" },
406 { :method => 'get', :path => "/queries.xml" },
407 { :controller => 'queries', :action => 'index', :format => 'xml' }
407 { :controller => 'queries', :action => 'index', :format => 'xml' }
408 )
408 )
409 assert_routing(
409 assert_routing(
410 { :method => 'get', :path => "/queries.json" },
410 { :method => 'get', :path => "/queries.json" },
411 { :controller => 'queries', :action => 'index', :format => 'json' }
411 { :controller => 'queries', :action => 'index', :format => 'json' }
412 )
412 )
413 assert_routing(
413 assert_routing(
414 { :method => 'get', :path => "/queries/new" },
414 { :method => 'get', :path => "/queries/new" },
415 { :controller => 'queries', :action => 'new' }
415 { :controller => 'queries', :action => 'new' }
416 )
416 )
417 assert_routing(
417 assert_routing(
418 { :method => 'get', :path => "/projects/redmine/queries/new" },
418 { :method => 'get', :path => "/projects/redmine/queries/new" },
419 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
419 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
420 )
420 )
421 assert_routing(
421 assert_routing(
422 { :method => 'post', :path => "/queries" },
422 { :method => 'post', :path => "/queries" },
423 { :controller => 'queries', :action => 'create' }
423 { :controller => 'queries', :action => 'create' }
424 )
424 )
425 assert_routing(
425 assert_routing(
426 { :method => 'post', :path => "/projects/redmine/queries" },
426 { :method => 'post', :path => "/projects/redmine/queries" },
427 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
427 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
428 )
428 )
429 assert_routing(
429 assert_routing(
430 { :method => 'get', :path => "/queries/1/edit" },
430 { :method => 'get', :path => "/queries/1/edit" },
431 { :controller => 'queries', :action => 'edit', :id => '1' }
431 { :controller => 'queries', :action => 'edit', :id => '1' }
432 )
432 )
433 assert_routing(
433 assert_routing(
434 { :method => 'put', :path => "/queries/1" },
434 { :method => 'put', :path => "/queries/1" },
435 { :controller => 'queries', :action => 'update', :id => '1' }
435 { :controller => 'queries', :action => 'update', :id => '1' }
436 )
436 )
437 assert_routing(
437 assert_routing(
438 { :method => 'delete', :path => "/queries/1" },
438 { :method => 'delete', :path => "/queries/1" },
439 { :controller => 'queries', :action => 'destroy', :id => '1' }
439 { :controller => 'queries', :action => 'destroy', :id => '1' }
440 )
440 )
441 end
441 end
442
442
443 def test_roles
443 def test_roles
444 assert_routing(
444 assert_routing(
445 { :method => 'get', :path => "/roles" },
445 { :method => 'get', :path => "/roles" },
446 { :controller => 'roles', :action => 'index' }
446 { :controller => 'roles', :action => 'index' }
447 )
447 )
448 assert_routing(
448 assert_routing(
449 { :method => 'get', :path => "/roles/new" },
449 { :method => 'get', :path => "/roles/new" },
450 { :controller => 'roles', :action => 'new' }
450 { :controller => 'roles', :action => 'new' }
451 )
451 )
452 assert_routing(
452 assert_routing(
453 { :method => 'post', :path => "/roles" },
453 { :method => 'post', :path => "/roles" },
454 { :controller => 'roles', :action => 'create' }
454 { :controller => 'roles', :action => 'create' }
455 )
455 )
456 assert_routing(
456 assert_routing(
457 { :method => 'get', :path => "/roles/2/edit" },
457 { :method => 'get', :path => "/roles/2/edit" },
458 { :controller => 'roles', :action => 'edit', :id => '2' }
458 { :controller => 'roles', :action => 'edit', :id => '2' }
459 )
459 )
460 assert_routing(
460 assert_routing(
461 { :method => 'put', :path => "/roles/2" },
461 { :method => 'put', :path => "/roles/2" },
462 { :controller => 'roles', :action => 'update', :id => '2' }
462 { :controller => 'roles', :action => 'update', :id => '2' }
463 )
463 )
464 assert_routing(
464 assert_routing(
465 { :method => 'delete', :path => "/roles/2" },
465 { :method => 'delete', :path => "/roles/2" },
466 { :controller => 'roles', :action => 'destroy', :id => '2' }
466 { :controller => 'roles', :action => 'destroy', :id => '2' }
467 )
467 )
468 assert_routing(
468 assert_routing(
469 { :method => 'get', :path => "/roles/permissions" },
469 { :method => 'get', :path => "/roles/permissions" },
470 { :controller => 'roles', :action => 'permissions' }
470 { :controller => 'roles', :action => 'permissions' }
471 )
471 )
472 assert_routing(
472 assert_routing(
473 { :method => 'post', :path => "/roles/permissions" },
473 { :method => 'post', :path => "/roles/permissions" },
474 { :controller => 'roles', :action => 'permissions' }
474 { :controller => 'roles', :action => 'permissions' }
475 )
475 )
476 end
476 end
477
477
478 def test_timelogs_global
479 assert_routing(
480 { :method => 'get', :path => "/time_entries" },
481 { :controller => 'timelog', :action => 'index' }
482 )
483 assert_routing(
484 { :method => 'get', :path => "/time_entries.csv" },
485 { :controller => 'timelog', :action => 'index', :format => 'csv' }
486 )
487 assert_routing(
488 { :method => 'get', :path => "/time_entries.atom" },
489 { :controller => 'timelog', :action => 'index', :format => 'atom' }
490 )
491 assert_routing(
492 { :method => 'get', :path => "/time_entries/new" },
493 { :controller => 'timelog', :action => 'new' }
494 )
495 assert_routing(
496 { :method => 'get', :path => "/time_entries/22/edit" },
497 { :controller => 'timelog', :action => 'edit', :id => '22' }
498 )
499 assert_routing(
500 { :method => 'post', :path => "/time_entries" },
501 { :controller => 'timelog', :action => 'create' }
502 )
503 assert_routing(
504 { :method => 'put', :path => "/time_entries/22" },
505 { :controller => 'timelog', :action => 'update', :id => '22' }
506 )
507 assert_routing(
508 { :method => 'delete', :path => "/time_entries/55" },
509 { :controller => 'timelog', :action => 'destroy', :id => '55' }
510 )
511 end
512
513 def test_timelogs_scoped_under_project
514 assert_routing(
515 { :method => 'get', :path => "/projects/567/time_entries" },
516 { :controller => 'timelog', :action => 'index', :project_id => '567' }
517 )
518 assert_routing(
519 { :method => 'get', :path => "/projects/567/time_entries.csv" },
520 { :controller => 'timelog', :action => 'index', :project_id => '567',
521 :format => 'csv' }
522 )
523 assert_routing(
524 { :method => 'get', :path => "/projects/567/time_entries.atom" },
525 { :controller => 'timelog', :action => 'index', :project_id => '567',
526 :format => 'atom' }
527 )
528 assert_routing(
529 { :method => 'get', :path => "/projects/567/time_entries/new" },
530 { :controller => 'timelog', :action => 'new', :project_id => '567' }
531 )
532 assert_routing(
533 { :method => 'get', :path => "/projects/567/time_entries/22/edit" },
534 { :controller => 'timelog', :action => 'edit',
535 :id => '22', :project_id => '567' }
536 )
537 assert_routing(
538 { :method => 'post', :path => "/projects/567/time_entries" },
539 { :controller => 'timelog', :action => 'create',
540 :project_id => '567' }
541 )
542 assert_routing(
543 { :method => 'put', :path => "/projects/567/time_entries/22" },
544 { :controller => 'timelog', :action => 'update',
545 :id => '22', :project_id => '567' }
546 )
547 assert_routing(
548 { :method => 'delete', :path => "/projects/567/time_entries/55" },
549 { :controller => 'timelog', :action => 'destroy',
550 :id => '55', :project_id => '567' }
551 )
552 end
553
554 def test_timelogs_scoped_under_issues
555 assert_routing(
556 { :method => 'get', :path => "/issues/234/time_entries" },
557 { :controller => 'timelog', :action => 'index', :issue_id => '234' }
558 )
559 assert_routing(
560 { :method => 'get', :path => "/issues/234/time_entries.csv" },
561 { :controller => 'timelog', :action => 'index', :issue_id => '234',
562 :format => 'csv' }
563 )
564 assert_routing(
565 { :method => 'get', :path => "/issues/234/time_entries.atom" },
566 { :controller => 'timelog', :action => 'index', :issue_id => '234',
567 :format => 'atom' }
568 )
569 assert_routing(
570 { :method => 'get', :path => "/issues/234/time_entries/new" },
571 { :controller => 'timelog', :action => 'new', :issue_id => '234' }
572 )
573 assert_routing(
574 { :method => 'get', :path => "/issues/234/time_entries/22/edit" },
575 { :controller => 'timelog', :action => 'edit', :id => '22',
576 :issue_id => '234' }
577 )
578 assert_routing(
579 { :method => 'post', :path => "/issues/234/time_entries" },
580 { :controller => 'timelog', :action => 'create', :issue_id => '234' }
581 )
582 assert_routing(
583 { :method => 'put', :path => "/issues/234/time_entries/22" },
584 { :controller => 'timelog', :action => 'update', :id => '22',
585 :issue_id => '234' }
586 )
587 assert_routing(
588 { :method => 'delete', :path => "/issues/234/time_entries/55" },
589 { :controller => 'timelog', :action => 'destroy', :id => '55',
590 :issue_id => '234' }
591 )
592 end
593
594 def test_timelogs_scoped_under_project_and_issues
595 assert_routing(
596 { :method => 'get',
597 :path => "/projects/ecookbook/issues/234/time_entries" },
598 { :controller => 'timelog', :action => 'index',
599 :issue_id => '234', :project_id => 'ecookbook' }
600 )
601 assert_routing(
602 { :method => 'get',
603 :path => "/projects/ecookbook/issues/234/time_entries.csv" },
604 { :controller => 'timelog', :action => 'index',
605 :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' }
606 )
607 assert_routing(
608 { :method => 'get',
609 :path => "/projects/ecookbook/issues/234/time_entries.atom" },
610 { :controller => 'timelog', :action => 'index',
611 :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' }
612 )
613 assert_routing(
614 { :method => 'get',
615 :path => "/projects/ecookbook/issues/234/time_entries/new" },
616 { :controller => 'timelog', :action => 'new',
617 :issue_id => '234', :project_id => 'ecookbook' }
618 )
619 assert_routing(
620 { :method => 'get',
621 :path => "/projects/ecookbook/issues/234/time_entries/22/edit" },
622 { :controller => 'timelog', :action => 'edit', :id => '22',
623 :issue_id => '234', :project_id => 'ecookbook' }
624 )
625 assert_routing(
626 { :method => 'post',
627 :path => "/projects/ecookbook/issues/234/time_entries" },
628 { :controller => 'timelog', :action => 'create',
629 :issue_id => '234', :project_id => 'ecookbook' }
630 )
631 assert_routing(
632 { :method => 'put',
633 :path => "/projects/ecookbook/issues/234/time_entries/22" },
634 { :controller => 'timelog', :action => 'update', :id => '22',
635 :issue_id => '234', :project_id => 'ecookbook' }
636 )
637 assert_routing(
638 { :method => 'delete',
639 :path => "/projects/ecookbook/issues/234/time_entries/55" },
640 { :controller => 'timelog', :action => 'destroy', :id => '55',
641 :issue_id => '234', :project_id => 'ecookbook' }
642 )
643 assert_routing(
644 { :method => 'get',
645 :path => "/time_entries/report" },
646 { :controller => 'timelog', :action => 'report' }
647 )
648 assert_routing(
649 { :method => 'get',
650 :path => "/projects/567/time_entries/report" },
651 { :controller => 'timelog', :action => 'report', :project_id => '567' }
652 )
653 assert_routing(
654 { :method => 'get',
655 :path => "/projects/567/time_entries/report.csv" },
656 { :controller => 'timelog', :action => 'report', :project_id => '567',
657 :format => 'csv' }
658 )
659 end
660
661 def test_users
478 def test_users
662 assert_routing(
479 assert_routing(
663 { :method => 'get', :path => "/users" },
480 { :method => 'get', :path => "/users" },
664 { :controller => 'users', :action => 'index' }
481 { :controller => 'users', :action => 'index' }
665 )
482 )
666 assert_routing(
483 assert_routing(
667 { :method => 'get', :path => "/users.xml" },
484 { :method => 'get', :path => "/users.xml" },
668 { :controller => 'users', :action => 'index', :format => 'xml' }
485 { :controller => 'users', :action => 'index', :format => 'xml' }
669 )
486 )
670 assert_routing(
487 assert_routing(
671 { :method => 'get', :path => "/users/44" },
488 { :method => 'get', :path => "/users/44" },
672 { :controller => 'users', :action => 'show', :id => '44' }
489 { :controller => 'users', :action => 'show', :id => '44' }
673 )
490 )
674 assert_routing(
491 assert_routing(
675 { :method => 'get', :path => "/users/44.xml" },
492 { :method => 'get', :path => "/users/44.xml" },
676 { :controller => 'users', :action => 'show', :id => '44',
493 { :controller => 'users', :action => 'show', :id => '44',
677 :format => 'xml' }
494 :format => 'xml' }
678 )
495 )
679 assert_routing(
496 assert_routing(
680 { :method => 'get', :path => "/users/current" },
497 { :method => 'get', :path => "/users/current" },
681 { :controller => 'users', :action => 'show', :id => 'current' }
498 { :controller => 'users', :action => 'show', :id => 'current' }
682 )
499 )
683 assert_routing(
500 assert_routing(
684 { :method => 'get', :path => "/users/current.xml" },
501 { :method => 'get', :path => "/users/current.xml" },
685 { :controller => 'users', :action => 'show', :id => 'current',
502 { :controller => 'users', :action => 'show', :id => 'current',
686 :format => 'xml' }
503 :format => 'xml' }
687 )
504 )
688 assert_routing(
505 assert_routing(
689 { :method => 'get', :path => "/users/new" },
506 { :method => 'get', :path => "/users/new" },
690 { :controller => 'users', :action => 'new' }
507 { :controller => 'users', :action => 'new' }
691 )
508 )
692 assert_routing(
509 assert_routing(
693 { :method => 'get', :path => "/users/444/edit" },
510 { :method => 'get', :path => "/users/444/edit" },
694 { :controller => 'users', :action => 'edit', :id => '444' }
511 { :controller => 'users', :action => 'edit', :id => '444' }
695 )
512 )
696 assert_routing(
513 assert_routing(
697 { :method => 'post', :path => "/users" },
514 { :method => 'post', :path => "/users" },
698 { :controller => 'users', :action => 'create' }
515 { :controller => 'users', :action => 'create' }
699 )
516 )
700 assert_routing(
517 assert_routing(
701 { :method => 'post', :path => "/users.xml" },
518 { :method => 'post', :path => "/users.xml" },
702 { :controller => 'users', :action => 'create', :format => 'xml' }
519 { :controller => 'users', :action => 'create', :format => 'xml' }
703 )
520 )
704 assert_routing(
521 assert_routing(
705 { :method => 'put', :path => "/users/444" },
522 { :method => 'put', :path => "/users/444" },
706 { :controller => 'users', :action => 'update', :id => '444' }
523 { :controller => 'users', :action => 'update', :id => '444' }
707 )
524 )
708 assert_routing(
525 assert_routing(
709 { :method => 'put', :path => "/users/444.xml" },
526 { :method => 'put', :path => "/users/444.xml" },
710 { :controller => 'users', :action => 'update', :id => '444',
527 { :controller => 'users', :action => 'update', :id => '444',
711 :format => 'xml' }
528 :format => 'xml' }
712 )
529 )
713 assert_routing(
530 assert_routing(
714 { :method => 'delete', :path => "/users/44" },
531 { :method => 'delete', :path => "/users/44" },
715 { :controller => 'users', :action => 'destroy', :id => '44' }
532 { :controller => 'users', :action => 'destroy', :id => '44' }
716 )
533 )
717 assert_routing(
534 assert_routing(
718 { :method => 'delete', :path => "/users/44.xml" },
535 { :method => 'delete', :path => "/users/44.xml" },
719 { :controller => 'users', :action => 'destroy', :id => '44',
536 { :controller => 'users', :action => 'destroy', :id => '44',
720 :format => 'xml' }
537 :format => 'xml' }
721 )
538 )
722 assert_routing(
539 assert_routing(
723 { :method => 'post', :path => "/users/123/memberships" },
540 { :method => 'post', :path => "/users/123/memberships" },
724 { :controller => 'users', :action => 'edit_membership',
541 { :controller => 'users', :action => 'edit_membership',
725 :id => '123' }
542 :id => '123' }
726 )
543 )
727 assert_routing(
544 assert_routing(
728 { :method => 'put', :path => "/users/123/memberships/55" },
545 { :method => 'put', :path => "/users/123/memberships/55" },
729 { :controller => 'users', :action => 'edit_membership',
546 { :controller => 'users', :action => 'edit_membership',
730 :id => '123', :membership_id => '55' }
547 :id => '123', :membership_id => '55' }
731 )
548 )
732 assert_routing(
549 assert_routing(
733 { :method => 'delete', :path => "/users/123/memberships/55" },
550 { :method => 'delete', :path => "/users/123/memberships/55" },
734 { :controller => 'users', :action => 'destroy_membership',
551 { :controller => 'users', :action => 'destroy_membership',
735 :id => '123', :membership_id => '55' }
552 :id => '123', :membership_id => '55' }
736 )
553 )
737 end
554 end
738
555
739 def test_welcome
556 def test_welcome
740 assert_routing(
557 assert_routing(
741 { :method => 'get', :path => "/robots.txt" },
558 { :method => 'get', :path => "/robots.txt" },
742 { :controller => 'welcome', :action => 'robots' }
559 { :controller => 'welcome', :action => 'robots' }
743 )
560 )
744 end
561 end
745
562
746 def test_wiki_singular_projects_pages
563 def test_wiki_singular_projects_pages
747 assert_routing(
564 assert_routing(
748 { :method => 'get', :path => "/projects/567/wiki" },
565 { :method => 'get', :path => "/projects/567/wiki" },
749 { :controller => 'wiki', :action => 'show', :project_id => '567' }
566 { :controller => 'wiki', :action => 'show', :project_id => '567' }
750 )
567 )
751 assert_routing(
568 assert_routing(
752 { :method => 'get', :path => "/projects/567/wiki/lalala" },
569 { :method => 'get', :path => "/projects/567/wiki/lalala" },
753 { :controller => 'wiki', :action => 'show', :project_id => '567',
570 { :controller => 'wiki', :action => 'show', :project_id => '567',
754 :id => 'lalala' }
571 :id => 'lalala' }
755 )
572 )
756 assert_routing(
573 assert_routing(
757 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
574 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
758 { :controller => 'wiki', :action => 'edit', :project_id => '567',
575 { :controller => 'wiki', :action => 'edit', :project_id => '567',
759 :id => 'my_page' }
576 :id => 'my_page' }
760 )
577 )
761 assert_routing(
578 assert_routing(
762 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
579 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
763 { :controller => 'wiki', :action => 'history', :project_id => '1',
580 { :controller => 'wiki', :action => 'history', :project_id => '1',
764 :id => 'CookBook_documentation' }
581 :id => 'CookBook_documentation' }
765 )
582 )
766 assert_routing(
583 assert_routing(
767 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
584 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
768 { :controller => 'wiki', :action => 'diff', :project_id => '1',
585 { :controller => 'wiki', :action => 'diff', :project_id => '1',
769 :id => 'CookBook_documentation' }
586 :id => 'CookBook_documentation' }
770 )
587 )
771 assert_routing(
588 assert_routing(
772 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
589 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
773 { :controller => 'wiki', :action => 'diff', :project_id => '1',
590 { :controller => 'wiki', :action => 'diff', :project_id => '1',
774 :id => 'CookBook_documentation', :version => '2' }
591 :id => 'CookBook_documentation', :version => '2' }
775 )
592 )
776 assert_routing(
593 assert_routing(
777 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
594 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
778 { :controller => 'wiki', :action => 'diff', :project_id => '1',
595 { :controller => 'wiki', :action => 'diff', :project_id => '1',
779 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
596 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
780 )
597 )
781 assert_routing(
598 assert_routing(
782 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
599 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
783 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
600 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
784 :id => 'CookBook_documentation', :version => '2' }
601 :id => 'CookBook_documentation', :version => '2' }
785 )
602 )
786 assert_routing(
603 assert_routing(
787 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
604 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
788 { :controller => 'wiki', :action => 'rename', :project_id => '22',
605 { :controller => 'wiki', :action => 'rename', :project_id => '22',
789 :id => 'ladida' }
606 :id => 'ladida' }
790 )
607 )
791 assert_routing(
608 assert_routing(
792 { :method => 'get', :path => "/projects/567/wiki/index" },
609 { :method => 'get', :path => "/projects/567/wiki/index" },
793 { :controller => 'wiki', :action => 'index', :project_id => '567' }
610 { :controller => 'wiki', :action => 'index', :project_id => '567' }
794 )
611 )
795 assert_routing(
612 assert_routing(
796 { :method => 'get', :path => "/projects/567/wiki/date_index" },
613 { :method => 'get', :path => "/projects/567/wiki/date_index" },
797 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
614 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
798 )
615 )
799 assert_routing(
616 assert_routing(
800 { :method => 'get', :path => "/projects/567/wiki/export" },
617 { :method => 'get', :path => "/projects/567/wiki/export" },
801 { :controller => 'wiki', :action => 'export', :project_id => '567' }
618 { :controller => 'wiki', :action => 'export', :project_id => '567' }
802 )
619 )
803 assert_routing(
620 assert_routing(
804 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
621 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
805 { :controller => 'wiki', :action => 'preview', :project_id => '567',
622 { :controller => 'wiki', :action => 'preview', :project_id => '567',
806 :id => 'CookBook_documentation' }
623 :id => 'CookBook_documentation' }
807 )
624 )
808 assert_routing(
625 assert_routing(
809 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
626 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
810 { :controller => 'wiki', :action => 'rename', :project_id => '22',
627 { :controller => 'wiki', :action => 'rename', :project_id => '22',
811 :id => 'ladida' }
628 :id => 'ladida' }
812 )
629 )
813 assert_routing(
630 assert_routing(
814 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
631 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
815 { :controller => 'wiki', :action => 'protect', :project_id => '22',
632 { :controller => 'wiki', :action => 'protect', :project_id => '22',
816 :id => 'ladida' }
633 :id => 'ladida' }
817 )
634 )
818 assert_routing(
635 assert_routing(
819 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
636 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
820 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
637 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
821 :id => 'ladida' }
638 :id => 'ladida' }
822 )
639 )
823 assert_routing(
640 assert_routing(
824 { :method => 'put', :path => "/projects/567/wiki/my_page" },
641 { :method => 'put', :path => "/projects/567/wiki/my_page" },
825 { :controller => 'wiki', :action => 'update', :project_id => '567',
642 { :controller => 'wiki', :action => 'update', :project_id => '567',
826 :id => 'my_page' }
643 :id => 'my_page' }
827 )
644 )
828 assert_routing(
645 assert_routing(
829 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
646 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
830 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
647 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
831 :id => 'ladida' }
648 :id => 'ladida' }
832 )
649 )
833 end
650 end
834
651
835 def test_wikis_plural_admin_setup
652 def test_wikis_plural_admin_setup
836 assert_routing(
653 assert_routing(
837 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
654 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
838 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
655 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
839 )
656 )
840 assert_routing(
657 assert_routing(
841 { :method => 'post', :path => "/projects/ladida/wiki" },
658 { :method => 'post', :path => "/projects/ladida/wiki" },
842 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
659 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
843 )
660 )
844 assert_routing(
661 assert_routing(
845 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
662 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
846 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
663 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
847 )
664 )
848 end
665 end
849 end
666 end
General Comments 0
You need to be logged in to leave comments. Login now