##// END OF EJS Templates
test: route: move projects test to new file...
Toshi MARUYAMA -
r8240:0bfdf7d5b759
parent child
Show More
@@ -0,0 +1,91
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 RoutingProjectsTest < ActionController::IntegrationTest
21 def test_projects
22 assert_routing(
23 { :method => 'get', :path => "/projects" },
24 { :controller => 'projects', :action => 'index' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/projects.atom" },
28 { :controller => 'projects', :action => 'index', :format => 'atom' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/projects.xml" },
32 { :controller => 'projects', :action => 'index', :format => 'xml' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/projects/new" },
36 { :controller => 'projects', :action => 'new' }
37 )
38 assert_routing(
39 { :method => 'get', :path => "/projects/test" },
40 { :controller => 'projects', :action => 'show', :id => 'test' }
41 )
42 assert_routing(
43 { :method => 'get', :path => "/projects/1.xml" },
44 { :controller => 'projects', :action => 'show', :id => '1',
45 :format => 'xml' }
46 )
47 assert_routing(
48 { :method => 'get', :path => "/projects/4223/settings" },
49 { :controller => 'projects', :action => 'settings', :id => '4223' }
50 )
51 assert_routing(
52 { :method => 'get', :path => "/projects/4223/settings/members" },
53 { :controller => 'projects', :action => 'settings', :id => '4223',
54 :tab => 'members' }
55 )
56 assert_routing(
57 { :method => 'post', :path => "/projects" },
58 { :controller => 'projects', :action => 'create' }
59 )
60 assert_routing(
61 { :method => 'post', :path => "/projects.xml" },
62 { :controller => 'projects', :action => 'create', :format => 'xml' }
63 )
64 assert_routing(
65 { :method => 'post', :path => "/projects/64/archive" },
66 { :controller => 'projects', :action => 'archive', :id => '64' }
67 )
68 assert_routing(
69 { :method => 'post', :path => "/projects/64/unarchive" },
70 { :controller => 'projects', :action => 'unarchive', :id => '64' }
71 )
72 assert_routing(
73 { :method => 'put', :path => "/projects/4223" },
74 { :controller => 'projects', :action => 'update', :id => '4223' }
75 )
76 assert_routing(
77 { :method => 'put', :path => "/projects/1.xml" },
78 { :controller => 'projects', :action => 'update', :id => '1',
79 :format => 'xml' }
80 )
81 assert_routing(
82 { :method => 'delete', :path => "/projects/64" },
83 { :controller => 'projects', :action => 'destroy', :id => '64' }
84 )
85 assert_routing(
86 { :method => 'delete', :path => "/projects/1.xml" },
87 { :controller => 'projects', :action => 'destroy', :id => '1',
88 :format => 'xml' }
89 )
90 end
91 end
@@ -1,234 +1,163
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class RoutingTest < ActionController::IntegrationTest
21 def test_projects
22 assert_routing(
23 { :method => 'get', :path => "/projects" },
24 { :controller => 'projects', :action => 'index' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/projects.atom" },
28 { :controller => 'projects', :action => 'index', :format => 'atom' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/projects.xml" },
32 { :controller => 'projects', :action => 'index', :format => 'xml' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/projects/new" },
36 { :controller => 'projects', :action => 'new' }
37 )
38 assert_routing(
39 { :method => 'get', :path => "/projects/test" },
40 { :controller => 'projects', :action => 'show', :id => 'test' }
41 )
42 assert_routing(
43 { :method => 'get', :path => "/projects/1.xml" },
44 { :controller => 'projects', :action => 'show', :id => '1',
45 :format => 'xml' }
46 )
47 assert_routing(
48 { :method => 'get', :path => "/projects/4223/settings" },
49 { :controller => 'projects', :action => 'settings', :id => '4223' }
50 )
51 assert_routing(
52 { :method => 'get', :path => "/projects/4223/settings/members" },
53 { :controller => 'projects', :action => 'settings', :id => '4223',
54 :tab => 'members' }
55 )
56 assert_routing(
57 { :method => 'post', :path => "/projects" },
58 { :controller => 'projects', :action => 'create' }
59 )
60 assert_routing(
61 { :method => 'post', :path => "/projects.xml" },
62 { :controller => 'projects', :action => 'create', :format => 'xml' }
63 )
64 assert_routing(
65 { :method => 'post', :path => "/projects/64/archive" },
66 { :controller => 'projects', :action => 'archive', :id => '64' }
67 )
68 assert_routing(
69 { :method => 'post', :path => "/projects/64/unarchive" },
70 { :controller => 'projects', :action => 'unarchive', :id => '64' }
71 )
72 assert_routing(
73 { :method => 'put', :path => "/projects/4223" },
74 { :controller => 'projects', :action => 'update', :id => '4223' }
75 )
76 assert_routing(
77 { :method => 'put', :path => "/projects/1.xml" },
78 { :controller => 'projects', :action => 'update', :id => '1',
79 :format => 'xml' }
80 )
81 assert_routing(
82 { :method => 'delete', :path => "/projects/64" },
83 { :controller => 'projects', :action => 'destroy', :id => '64' }
84 )
85 assert_routing(
86 { :method => 'delete', :path => "/projects/1.xml" },
87 { :controller => 'projects', :action => 'destroy', :id => '1',
88 :format => 'xml' }
89 )
90 end
91
92 21 def test_queries
93 22 assert_routing(
94 23 { :method => 'get', :path => "/queries.xml" },
95 24 { :controller => 'queries', :action => 'index', :format => 'xml' }
96 25 )
97 26 assert_routing(
98 27 { :method => 'get', :path => "/queries.json" },
99 28 { :controller => 'queries', :action => 'index', :format => 'json' }
100 29 )
101 30 assert_routing(
102 31 { :method => 'get', :path => "/queries/new" },
103 32 { :controller => 'queries', :action => 'new' }
104 33 )
105 34 assert_routing(
106 35 { :method => 'get', :path => "/projects/redmine/queries/new" },
107 36 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
108 37 )
109 38 assert_routing(
110 39 { :method => 'post', :path => "/queries" },
111 40 { :controller => 'queries', :action => 'create' }
112 41 )
113 42 assert_routing(
114 43 { :method => 'post', :path => "/projects/redmine/queries" },
115 44 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
116 45 )
117 46 assert_routing(
118 47 { :method => 'get', :path => "/queries/1/edit" },
119 48 { :controller => 'queries', :action => 'edit', :id => '1' }
120 49 )
121 50 assert_routing(
122 51 { :method => 'put', :path => "/queries/1" },
123 52 { :controller => 'queries', :action => 'update', :id => '1' }
124 53 )
125 54 assert_routing(
126 55 { :method => 'delete', :path => "/queries/1" },
127 56 { :controller => 'queries', :action => 'destroy', :id => '1' }
128 57 )
129 58 end
130 59
131 60 def test_wiki_singular_projects_pages
132 61 assert_routing(
133 62 { :method => 'get', :path => "/projects/567/wiki" },
134 63 { :controller => 'wiki', :action => 'show', :project_id => '567' }
135 64 )
136 65 assert_routing(
137 66 { :method => 'get', :path => "/projects/567/wiki/lalala" },
138 67 { :controller => 'wiki', :action => 'show', :project_id => '567',
139 68 :id => 'lalala' }
140 69 )
141 70 assert_routing(
142 71 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
143 72 { :controller => 'wiki', :action => 'edit', :project_id => '567',
144 73 :id => 'my_page' }
145 74 )
146 75 assert_routing(
147 76 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
148 77 { :controller => 'wiki', :action => 'history', :project_id => '1',
149 78 :id => 'CookBook_documentation' }
150 79 )
151 80 assert_routing(
152 81 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
153 82 { :controller => 'wiki', :action => 'diff', :project_id => '1',
154 83 :id => 'CookBook_documentation' }
155 84 )
156 85 assert_routing(
157 86 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
158 87 { :controller => 'wiki', :action => 'diff', :project_id => '1',
159 88 :id => 'CookBook_documentation', :version => '2' }
160 89 )
161 90 assert_routing(
162 91 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
163 92 { :controller => 'wiki', :action => 'diff', :project_id => '1',
164 93 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
165 94 )
166 95 assert_routing(
167 96 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
168 97 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
169 98 :id => 'CookBook_documentation', :version => '2' }
170 99 )
171 100 assert_routing(
172 101 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
173 102 { :controller => 'wiki', :action => 'rename', :project_id => '22',
174 103 :id => 'ladida' }
175 104 )
176 105 assert_routing(
177 106 { :method => 'get', :path => "/projects/567/wiki/index" },
178 107 { :controller => 'wiki', :action => 'index', :project_id => '567' }
179 108 )
180 109 assert_routing(
181 110 { :method => 'get', :path => "/projects/567/wiki/date_index" },
182 111 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
183 112 )
184 113 assert_routing(
185 114 { :method => 'get', :path => "/projects/567/wiki/export" },
186 115 { :controller => 'wiki', :action => 'export', :project_id => '567' }
187 116 )
188 117 assert_routing(
189 118 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
190 119 { :controller => 'wiki', :action => 'preview', :project_id => '567',
191 120 :id => 'CookBook_documentation' }
192 121 )
193 122 assert_routing(
194 123 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
195 124 { :controller => 'wiki', :action => 'rename', :project_id => '22',
196 125 :id => 'ladida' }
197 126 )
198 127 assert_routing(
199 128 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
200 129 { :controller => 'wiki', :action => 'protect', :project_id => '22',
201 130 :id => 'ladida' }
202 131 )
203 132 assert_routing(
204 133 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
205 134 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
206 135 :id => 'ladida' }
207 136 )
208 137 assert_routing(
209 138 { :method => 'put', :path => "/projects/567/wiki/my_page" },
210 139 { :controller => 'wiki', :action => 'update', :project_id => '567',
211 140 :id => 'my_page' }
212 141 )
213 142 assert_routing(
214 143 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
215 144 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
216 145 :id => 'ladida' }
217 146 )
218 147 end
219 148
220 149 def test_wikis_plural_admin_setup
221 150 assert_routing(
222 151 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
223 152 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
224 153 )
225 154 assert_routing(
226 155 { :method => 'post', :path => "/projects/ladida/wiki" },
227 156 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
228 157 )
229 158 assert_routing(
230 159 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
231 160 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
232 161 )
233 162 end
234 163 end
General Comments 0
You need to be logged in to leave comments. Login now