##// END OF EJS Templates
test: route: move project_enumerations test in project test to new file...
Toshi MARUYAMA -
r8239:73123df4beb6
parent child
Show More
@@ -0,0 +1,33
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 RoutingProjectEnumerationsTest < ActionController::IntegrationTest
21 def test_project_enumerations
22 assert_routing(
23 { :method => 'put', :path => "/projects/64/enumerations" },
24 { :controller => 'project_enumerations', :action => 'update',
25 :project_id => '64' }
26 )
27 assert_routing(
28 { :method => 'delete', :path => "/projects/64/enumerations" },
29 { :controller => 'project_enumerations', :action => 'destroy',
30 :project_id => '64' }
31 )
32 end
33 end
@@ -1,244 +1,234
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_projects
21 def test_projects
22 assert_routing(
22 assert_routing(
23 { :method => 'get', :path => "/projects" },
23 { :method => 'get', :path => "/projects" },
24 { :controller => 'projects', :action => 'index' }
24 { :controller => 'projects', :action => 'index' }
25 )
25 )
26 assert_routing(
26 assert_routing(
27 { :method => 'get', :path => "/projects.atom" },
27 { :method => 'get', :path => "/projects.atom" },
28 { :controller => 'projects', :action => 'index', :format => 'atom' }
28 { :controller => 'projects', :action => 'index', :format => 'atom' }
29 )
29 )
30 assert_routing(
30 assert_routing(
31 { :method => 'get', :path => "/projects.xml" },
31 { :method => 'get', :path => "/projects.xml" },
32 { :controller => 'projects', :action => 'index', :format => 'xml' }
32 { :controller => 'projects', :action => 'index', :format => 'xml' }
33 )
33 )
34 assert_routing(
34 assert_routing(
35 { :method => 'get', :path => "/projects/new" },
35 { :method => 'get', :path => "/projects/new" },
36 { :controller => 'projects', :action => 'new' }
36 { :controller => 'projects', :action => 'new' }
37 )
37 )
38 assert_routing(
38 assert_routing(
39 { :method => 'get', :path => "/projects/test" },
39 { :method => 'get', :path => "/projects/test" },
40 { :controller => 'projects', :action => 'show', :id => 'test' }
40 { :controller => 'projects', :action => 'show', :id => 'test' }
41 )
41 )
42 assert_routing(
42 assert_routing(
43 { :method => 'get', :path => "/projects/1.xml" },
43 { :method => 'get', :path => "/projects/1.xml" },
44 { :controller => 'projects', :action => 'show', :id => '1',
44 { :controller => 'projects', :action => 'show', :id => '1',
45 :format => 'xml' }
45 :format => 'xml' }
46 )
46 )
47 assert_routing(
47 assert_routing(
48 { :method => 'get', :path => "/projects/4223/settings" },
48 { :method => 'get', :path => "/projects/4223/settings" },
49 { :controller => 'projects', :action => 'settings', :id => '4223' }
49 { :controller => 'projects', :action => 'settings', :id => '4223' }
50 )
50 )
51 assert_routing(
51 assert_routing(
52 { :method => 'get', :path => "/projects/4223/settings/members" },
52 { :method => 'get', :path => "/projects/4223/settings/members" },
53 { :controller => 'projects', :action => 'settings', :id => '4223',
53 { :controller => 'projects', :action => 'settings', :id => '4223',
54 :tab => 'members' }
54 :tab => 'members' }
55 )
55 )
56 assert_routing(
56 assert_routing(
57 { :method => 'post', :path => "/projects" },
57 { :method => 'post', :path => "/projects" },
58 { :controller => 'projects', :action => 'create' }
58 { :controller => 'projects', :action => 'create' }
59 )
59 )
60 assert_routing(
60 assert_routing(
61 { :method => 'post', :path => "/projects.xml" },
61 { :method => 'post', :path => "/projects.xml" },
62 { :controller => 'projects', :action => 'create', :format => 'xml' }
62 { :controller => 'projects', :action => 'create', :format => 'xml' }
63 )
63 )
64 assert_routing(
64 assert_routing(
65 { :method => 'post', :path => "/projects/64/archive" },
65 { :method => 'post', :path => "/projects/64/archive" },
66 { :controller => 'projects', :action => 'archive', :id => '64' }
66 { :controller => 'projects', :action => 'archive', :id => '64' }
67 )
67 )
68 assert_routing(
68 assert_routing(
69 { :method => 'post', :path => "/projects/64/unarchive" },
69 { :method => 'post', :path => "/projects/64/unarchive" },
70 { :controller => 'projects', :action => 'unarchive', :id => '64' }
70 { :controller => 'projects', :action => 'unarchive', :id => '64' }
71 )
71 )
72 assert_routing(
72 assert_routing(
73 { :method => 'put', :path => "/projects/64/enumerations" },
74 { :controller => 'project_enumerations', :action => 'update',
75 :project_id => '64' }
76 )
77 assert_routing(
78 { :method => 'put', :path => "/projects/4223" },
73 { :method => 'put', :path => "/projects/4223" },
79 { :controller => 'projects', :action => 'update', :id => '4223' }
74 { :controller => 'projects', :action => 'update', :id => '4223' }
80 )
75 )
81 assert_routing(
76 assert_routing(
82 { :method => 'put', :path => "/projects/1.xml" },
77 { :method => 'put', :path => "/projects/1.xml" },
83 { :controller => 'projects', :action => 'update', :id => '1',
78 { :controller => 'projects', :action => 'update', :id => '1',
84 :format => 'xml' }
79 :format => 'xml' }
85 )
80 )
86 assert_routing(
81 assert_routing(
87 { :method => 'delete', :path => "/projects/64" },
82 { :method => 'delete', :path => "/projects/64" },
88 { :controller => 'projects', :action => 'destroy', :id => '64' }
83 { :controller => 'projects', :action => 'destroy', :id => '64' }
89 )
84 )
90 assert_routing(
85 assert_routing(
91 { :method => 'delete', :path => "/projects/1.xml" },
86 { :method => 'delete', :path => "/projects/1.xml" },
92 { :controller => 'projects', :action => 'destroy', :id => '1',
87 { :controller => 'projects', :action => 'destroy', :id => '1',
93 :format => 'xml' }
88 :format => 'xml' }
94 )
89 )
95 assert_routing(
96 { :method => 'delete', :path => "/projects/64/enumerations" },
97 { :controller => 'project_enumerations', :action => 'destroy',
98 :project_id => '64' }
99 )
100 end
90 end
101
91
102 def test_queries
92 def test_queries
103 assert_routing(
93 assert_routing(
104 { :method => 'get', :path => "/queries.xml" },
94 { :method => 'get', :path => "/queries.xml" },
105 { :controller => 'queries', :action => 'index', :format => 'xml' }
95 { :controller => 'queries', :action => 'index', :format => 'xml' }
106 )
96 )
107 assert_routing(
97 assert_routing(
108 { :method => 'get', :path => "/queries.json" },
98 { :method => 'get', :path => "/queries.json" },
109 { :controller => 'queries', :action => 'index', :format => 'json' }
99 { :controller => 'queries', :action => 'index', :format => 'json' }
110 )
100 )
111 assert_routing(
101 assert_routing(
112 { :method => 'get', :path => "/queries/new" },
102 { :method => 'get', :path => "/queries/new" },
113 { :controller => 'queries', :action => 'new' }
103 { :controller => 'queries', :action => 'new' }
114 )
104 )
115 assert_routing(
105 assert_routing(
116 { :method => 'get', :path => "/projects/redmine/queries/new" },
106 { :method => 'get', :path => "/projects/redmine/queries/new" },
117 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
107 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
118 )
108 )
119 assert_routing(
109 assert_routing(
120 { :method => 'post', :path => "/queries" },
110 { :method => 'post', :path => "/queries" },
121 { :controller => 'queries', :action => 'create' }
111 { :controller => 'queries', :action => 'create' }
122 )
112 )
123 assert_routing(
113 assert_routing(
124 { :method => 'post', :path => "/projects/redmine/queries" },
114 { :method => 'post', :path => "/projects/redmine/queries" },
125 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
115 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
126 )
116 )
127 assert_routing(
117 assert_routing(
128 { :method => 'get', :path => "/queries/1/edit" },
118 { :method => 'get', :path => "/queries/1/edit" },
129 { :controller => 'queries', :action => 'edit', :id => '1' }
119 { :controller => 'queries', :action => 'edit', :id => '1' }
130 )
120 )
131 assert_routing(
121 assert_routing(
132 { :method => 'put', :path => "/queries/1" },
122 { :method => 'put', :path => "/queries/1" },
133 { :controller => 'queries', :action => 'update', :id => '1' }
123 { :controller => 'queries', :action => 'update', :id => '1' }
134 )
124 )
135 assert_routing(
125 assert_routing(
136 { :method => 'delete', :path => "/queries/1" },
126 { :method => 'delete', :path => "/queries/1" },
137 { :controller => 'queries', :action => 'destroy', :id => '1' }
127 { :controller => 'queries', :action => 'destroy', :id => '1' }
138 )
128 )
139 end
129 end
140
130
141 def test_wiki_singular_projects_pages
131 def test_wiki_singular_projects_pages
142 assert_routing(
132 assert_routing(
143 { :method => 'get', :path => "/projects/567/wiki" },
133 { :method => 'get', :path => "/projects/567/wiki" },
144 { :controller => 'wiki', :action => 'show', :project_id => '567' }
134 { :controller => 'wiki', :action => 'show', :project_id => '567' }
145 )
135 )
146 assert_routing(
136 assert_routing(
147 { :method => 'get', :path => "/projects/567/wiki/lalala" },
137 { :method => 'get', :path => "/projects/567/wiki/lalala" },
148 { :controller => 'wiki', :action => 'show', :project_id => '567',
138 { :controller => 'wiki', :action => 'show', :project_id => '567',
149 :id => 'lalala' }
139 :id => 'lalala' }
150 )
140 )
151 assert_routing(
141 assert_routing(
152 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
142 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
153 { :controller => 'wiki', :action => 'edit', :project_id => '567',
143 { :controller => 'wiki', :action => 'edit', :project_id => '567',
154 :id => 'my_page' }
144 :id => 'my_page' }
155 )
145 )
156 assert_routing(
146 assert_routing(
157 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
147 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
158 { :controller => 'wiki', :action => 'history', :project_id => '1',
148 { :controller => 'wiki', :action => 'history', :project_id => '1',
159 :id => 'CookBook_documentation' }
149 :id => 'CookBook_documentation' }
160 )
150 )
161 assert_routing(
151 assert_routing(
162 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
152 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
163 { :controller => 'wiki', :action => 'diff', :project_id => '1',
153 { :controller => 'wiki', :action => 'diff', :project_id => '1',
164 :id => 'CookBook_documentation' }
154 :id => 'CookBook_documentation' }
165 )
155 )
166 assert_routing(
156 assert_routing(
167 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
157 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
168 { :controller => 'wiki', :action => 'diff', :project_id => '1',
158 { :controller => 'wiki', :action => 'diff', :project_id => '1',
169 :id => 'CookBook_documentation', :version => '2' }
159 :id => 'CookBook_documentation', :version => '2' }
170 )
160 )
171 assert_routing(
161 assert_routing(
172 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
162 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
173 { :controller => 'wiki', :action => 'diff', :project_id => '1',
163 { :controller => 'wiki', :action => 'diff', :project_id => '1',
174 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
164 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
175 )
165 )
176 assert_routing(
166 assert_routing(
177 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
167 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
178 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
168 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
179 :id => 'CookBook_documentation', :version => '2' }
169 :id => 'CookBook_documentation', :version => '2' }
180 )
170 )
181 assert_routing(
171 assert_routing(
182 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
172 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
183 { :controller => 'wiki', :action => 'rename', :project_id => '22',
173 { :controller => 'wiki', :action => 'rename', :project_id => '22',
184 :id => 'ladida' }
174 :id => 'ladida' }
185 )
175 )
186 assert_routing(
176 assert_routing(
187 { :method => 'get', :path => "/projects/567/wiki/index" },
177 { :method => 'get', :path => "/projects/567/wiki/index" },
188 { :controller => 'wiki', :action => 'index', :project_id => '567' }
178 { :controller => 'wiki', :action => 'index', :project_id => '567' }
189 )
179 )
190 assert_routing(
180 assert_routing(
191 { :method => 'get', :path => "/projects/567/wiki/date_index" },
181 { :method => 'get', :path => "/projects/567/wiki/date_index" },
192 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
182 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
193 )
183 )
194 assert_routing(
184 assert_routing(
195 { :method => 'get', :path => "/projects/567/wiki/export" },
185 { :method => 'get', :path => "/projects/567/wiki/export" },
196 { :controller => 'wiki', :action => 'export', :project_id => '567' }
186 { :controller => 'wiki', :action => 'export', :project_id => '567' }
197 )
187 )
198 assert_routing(
188 assert_routing(
199 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
189 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
200 { :controller => 'wiki', :action => 'preview', :project_id => '567',
190 { :controller => 'wiki', :action => 'preview', :project_id => '567',
201 :id => 'CookBook_documentation' }
191 :id => 'CookBook_documentation' }
202 )
192 )
203 assert_routing(
193 assert_routing(
204 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
194 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
205 { :controller => 'wiki', :action => 'rename', :project_id => '22',
195 { :controller => 'wiki', :action => 'rename', :project_id => '22',
206 :id => 'ladida' }
196 :id => 'ladida' }
207 )
197 )
208 assert_routing(
198 assert_routing(
209 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
199 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
210 { :controller => 'wiki', :action => 'protect', :project_id => '22',
200 { :controller => 'wiki', :action => 'protect', :project_id => '22',
211 :id => 'ladida' }
201 :id => 'ladida' }
212 )
202 )
213 assert_routing(
203 assert_routing(
214 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
204 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
215 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
205 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
216 :id => 'ladida' }
206 :id => 'ladida' }
217 )
207 )
218 assert_routing(
208 assert_routing(
219 { :method => 'put', :path => "/projects/567/wiki/my_page" },
209 { :method => 'put', :path => "/projects/567/wiki/my_page" },
220 { :controller => 'wiki', :action => 'update', :project_id => '567',
210 { :controller => 'wiki', :action => 'update', :project_id => '567',
221 :id => 'my_page' }
211 :id => 'my_page' }
222 )
212 )
223 assert_routing(
213 assert_routing(
224 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
214 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
225 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
215 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
226 :id => 'ladida' }
216 :id => 'ladida' }
227 )
217 )
228 end
218 end
229
219
230 def test_wikis_plural_admin_setup
220 def test_wikis_plural_admin_setup
231 assert_routing(
221 assert_routing(
232 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
222 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
233 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
223 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
234 )
224 )
235 assert_routing(
225 assert_routing(
236 { :method => 'post', :path => "/projects/ladida/wiki" },
226 { :method => 'post', :path => "/projects/ladida/wiki" },
237 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
227 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
238 )
228 )
239 assert_routing(
229 assert_routing(
240 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
230 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
241 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
231 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
242 )
232 )
243 end
233 end
244 end
234 end
General Comments 0
You need to be logged in to leave comments. Login now