@@ -1,203 +1,221 | |||||
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 RoutingTimelogsTest < ActionController::IntegrationTest |
|
20 | class RoutingTimelogsTest < ActionController::IntegrationTest | |
21 | def test_timelogs_global |
|
21 | def test_timelogs_global | |
22 | assert_routing( |
|
22 | assert_routing( | |
23 | { :method => 'get', :path => "/time_entries" }, |
|
23 | { :method => 'get', :path => "/time_entries" }, | |
24 | { :controller => 'timelog', :action => 'index' } |
|
24 | { :controller => 'timelog', :action => 'index' } | |
25 | ) |
|
25 | ) | |
26 | assert_routing( |
|
26 | assert_routing( | |
27 | { :method => 'get', :path => "/time_entries.csv" }, |
|
27 | { :method => 'get', :path => "/time_entries.csv" }, | |
28 | { :controller => 'timelog', :action => 'index', :format => 'csv' } |
|
28 | { :controller => 'timelog', :action => 'index', :format => 'csv' } | |
29 | ) |
|
29 | ) | |
30 | assert_routing( |
|
30 | assert_routing( | |
31 | { :method => 'get', :path => "/time_entries.atom" }, |
|
31 | { :method => 'get', :path => "/time_entries.atom" }, | |
32 | { :controller => 'timelog', :action => 'index', :format => 'atom' } |
|
32 | { :controller => 'timelog', :action => 'index', :format => 'atom' } | |
33 | ) |
|
33 | ) | |
34 | assert_routing( |
|
34 | assert_routing( | |
35 | { :method => 'get', :path => "/time_entries/new" }, |
|
35 | { :method => 'get', :path => "/time_entries/new" }, | |
36 | { :controller => 'timelog', :action => 'new' } |
|
36 | { :controller => 'timelog', :action => 'new' } | |
37 | ) |
|
37 | ) | |
38 | assert_routing( |
|
38 | assert_routing( | |
39 | { :method => 'get', :path => "/time_entries/22/edit" }, |
|
39 | { :method => 'get', :path => "/time_entries/22/edit" }, | |
40 | { :controller => 'timelog', :action => 'edit', :id => '22' } |
|
40 | { :controller => 'timelog', :action => 'edit', :id => '22' } | |
41 | ) |
|
41 | ) | |
42 | assert_routing( |
|
42 | assert_routing( | |
43 | { :method => 'post', :path => "/time_entries" }, |
|
43 | { :method => 'post', :path => "/time_entries" }, | |
44 | { :controller => 'timelog', :action => 'create' } |
|
44 | { :controller => 'timelog', :action => 'create' } | |
45 | ) |
|
45 | ) | |
46 | assert_routing( |
|
46 | assert_routing( | |
47 | { :method => 'put', :path => "/time_entries/22" }, |
|
47 | { :method => 'put', :path => "/time_entries/22" }, | |
48 | { :controller => 'timelog', :action => 'update', :id => '22' } |
|
48 | { :controller => 'timelog', :action => 'update', :id => '22' } | |
49 | ) |
|
49 | ) | |
50 | assert_routing( |
|
50 | assert_routing( | |
51 | { :method => 'delete', :path => "/time_entries/55" }, |
|
51 | { :method => 'delete', :path => "/time_entries/55" }, | |
52 | { :controller => 'timelog', :action => 'destroy', :id => '55' } |
|
52 | { :controller => 'timelog', :action => 'destroy', :id => '55' } | |
53 | ) |
|
53 | ) | |
54 | end |
|
54 | end | |
55 |
|
55 | |||
56 | def test_timelogs_scoped_under_project |
|
56 | def test_timelogs_scoped_under_project | |
57 | assert_routing( |
|
57 | assert_routing( | |
58 | { :method => 'get', :path => "/projects/567/time_entries" }, |
|
58 | { :method => 'get', :path => "/projects/567/time_entries" }, | |
59 | { :controller => 'timelog', :action => 'index', :project_id => '567' } |
|
59 | { :controller => 'timelog', :action => 'index', :project_id => '567' } | |
60 | ) |
|
60 | ) | |
61 | assert_routing( |
|
61 | assert_routing( | |
62 | { :method => 'get', :path => "/projects/567/time_entries.csv" }, |
|
62 | { :method => 'get', :path => "/projects/567/time_entries.csv" }, | |
63 | { :controller => 'timelog', :action => 'index', :project_id => '567', |
|
63 | { :controller => 'timelog', :action => 'index', :project_id => '567', | |
64 | :format => 'csv' } |
|
64 | :format => 'csv' } | |
65 | ) |
|
65 | ) | |
66 | assert_routing( |
|
66 | assert_routing( | |
67 | { :method => 'get', :path => "/projects/567/time_entries.atom" }, |
|
67 | { :method => 'get', :path => "/projects/567/time_entries.atom" }, | |
68 | { :controller => 'timelog', :action => 'index', :project_id => '567', |
|
68 | { :controller => 'timelog', :action => 'index', :project_id => '567', | |
69 | :format => 'atom' } |
|
69 | :format => 'atom' } | |
70 | ) |
|
70 | ) | |
71 | assert_routing( |
|
71 | assert_routing( | |
72 | { :method => 'get', :path => "/projects/567/time_entries/new" }, |
|
72 | { :method => 'get', :path => "/projects/567/time_entries/new" }, | |
73 | { :controller => 'timelog', :action => 'new', :project_id => '567' } |
|
73 | { :controller => 'timelog', :action => 'new', :project_id => '567' } | |
74 | ) |
|
74 | ) | |
75 | assert_routing( |
|
75 | assert_routing( | |
76 | { :method => 'get', :path => "/projects/567/time_entries/22/edit" }, |
|
76 | { :method => 'get', :path => "/projects/567/time_entries/22/edit" }, | |
77 | { :controller => 'timelog', :action => 'edit', |
|
77 | { :controller => 'timelog', :action => 'edit', | |
78 | :id => '22', :project_id => '567' } |
|
78 | :id => '22', :project_id => '567' } | |
79 | ) |
|
79 | ) | |
80 | assert_routing( |
|
80 | assert_routing( | |
81 | { :method => 'post', :path => "/projects/567/time_entries" }, |
|
81 | { :method => 'post', :path => "/projects/567/time_entries" }, | |
82 | { :controller => 'timelog', :action => 'create', |
|
82 | { :controller => 'timelog', :action => 'create', | |
83 | :project_id => '567' } |
|
83 | :project_id => '567' } | |
84 | ) |
|
84 | ) | |
85 | assert_routing( |
|
85 | assert_routing( | |
86 | { :method => 'put', :path => "/projects/567/time_entries/22" }, |
|
86 | { :method => 'put', :path => "/projects/567/time_entries/22" }, | |
87 | { :controller => 'timelog', :action => 'update', |
|
87 | { :controller => 'timelog', :action => 'update', | |
88 | :id => '22', :project_id => '567' } |
|
88 | :id => '22', :project_id => '567' } | |
89 | ) |
|
89 | ) | |
90 | assert_routing( |
|
90 | assert_routing( | |
91 | { :method => 'delete', :path => "/projects/567/time_entries/55" }, |
|
91 | { :method => 'delete', :path => "/projects/567/time_entries/55" }, | |
92 | { :controller => 'timelog', :action => 'destroy', |
|
92 | { :controller => 'timelog', :action => 'destroy', | |
93 | :id => '55', :project_id => '567' } |
|
93 | :id => '55', :project_id => '567' } | |
94 | ) |
|
94 | ) | |
95 | end |
|
95 | end | |
96 |
|
96 | |||
97 | def test_timelogs_scoped_under_issues |
|
97 | def test_timelogs_scoped_under_issues | |
98 | assert_routing( |
|
98 | assert_routing( | |
99 | { :method => 'get', :path => "/issues/234/time_entries" }, |
|
99 | { :method => 'get', :path => "/issues/234/time_entries" }, | |
100 | { :controller => 'timelog', :action => 'index', :issue_id => '234' } |
|
100 | { :controller => 'timelog', :action => 'index', :issue_id => '234' } | |
101 | ) |
|
101 | ) | |
102 | assert_routing( |
|
102 | assert_routing( | |
103 | { :method => 'get', :path => "/issues/234/time_entries.csv" }, |
|
103 | { :method => 'get', :path => "/issues/234/time_entries.csv" }, | |
104 | { :controller => 'timelog', :action => 'index', :issue_id => '234', |
|
104 | { :controller => 'timelog', :action => 'index', :issue_id => '234', | |
105 | :format => 'csv' } |
|
105 | :format => 'csv' } | |
106 | ) |
|
106 | ) | |
107 | assert_routing( |
|
107 | assert_routing( | |
108 | { :method => 'get', :path => "/issues/234/time_entries.atom" }, |
|
108 | { :method => 'get', :path => "/issues/234/time_entries.atom" }, | |
109 | { :controller => 'timelog', :action => 'index', :issue_id => '234', |
|
109 | { :controller => 'timelog', :action => 'index', :issue_id => '234', | |
110 | :format => 'atom' } |
|
110 | :format => 'atom' } | |
111 | ) |
|
111 | ) | |
112 | assert_routing( |
|
112 | assert_routing( | |
113 | { :method => 'get', :path => "/issues/234/time_entries/new" }, |
|
113 | { :method => 'get', :path => "/issues/234/time_entries/new" }, | |
114 | { :controller => 'timelog', :action => 'new', :issue_id => '234' } |
|
114 | { :controller => 'timelog', :action => 'new', :issue_id => '234' } | |
115 | ) |
|
115 | ) | |
116 | assert_routing( |
|
116 | assert_routing( | |
117 | { :method => 'get', :path => "/issues/234/time_entries/22/edit" }, |
|
117 | { :method => 'get', :path => "/issues/234/time_entries/22/edit" }, | |
118 | { :controller => 'timelog', :action => 'edit', :id => '22', |
|
118 | { :controller => 'timelog', :action => 'edit', :id => '22', | |
119 | :issue_id => '234' } |
|
119 | :issue_id => '234' } | |
120 | ) |
|
120 | ) | |
121 | assert_routing( |
|
121 | assert_routing( | |
122 | { :method => 'post', :path => "/issues/234/time_entries" }, |
|
122 | { :method => 'post', :path => "/issues/234/time_entries" }, | |
123 | { :controller => 'timelog', :action => 'create', :issue_id => '234' } |
|
123 | { :controller => 'timelog', :action => 'create', :issue_id => '234' } | |
124 | ) |
|
124 | ) | |
125 | assert_routing( |
|
125 | assert_routing( | |
126 | { :method => 'put', :path => "/issues/234/time_entries/22" }, |
|
126 | { :method => 'put', :path => "/issues/234/time_entries/22" }, | |
127 | { :controller => 'timelog', :action => 'update', :id => '22', |
|
127 | { :controller => 'timelog', :action => 'update', :id => '22', | |
128 | :issue_id => '234' } |
|
128 | :issue_id => '234' } | |
129 | ) |
|
129 | ) | |
130 | assert_routing( |
|
130 | assert_routing( | |
131 | { :method => 'delete', :path => "/issues/234/time_entries/55" }, |
|
131 | { :method => 'delete', :path => "/issues/234/time_entries/55" }, | |
132 | { :controller => 'timelog', :action => 'destroy', :id => '55', |
|
132 | { :controller => 'timelog', :action => 'destroy', :id => '55', | |
133 | :issue_id => '234' } |
|
133 | :issue_id => '234' } | |
134 | ) |
|
134 | ) | |
135 | end |
|
135 | end | |
136 |
|
136 | |||
137 | def test_timelogs_scoped_under_project_and_issues |
|
137 | def test_timelogs_scoped_under_project_and_issues | |
138 | assert_routing( |
|
138 | assert_routing( | |
139 | { :method => 'get', |
|
139 | { :method => 'get', | |
140 | :path => "/projects/ecookbook/issues/234/time_entries" }, |
|
140 | :path => "/projects/ecookbook/issues/234/time_entries" }, | |
141 | { :controller => 'timelog', :action => 'index', |
|
141 | { :controller => 'timelog', :action => 'index', | |
142 | :issue_id => '234', :project_id => 'ecookbook' } |
|
142 | :issue_id => '234', :project_id => 'ecookbook' } | |
143 | ) |
|
143 | ) | |
144 | assert_routing( |
|
144 | assert_routing( | |
145 | { :method => 'get', |
|
145 | { :method => 'get', | |
146 | :path => "/projects/ecookbook/issues/234/time_entries.csv" }, |
|
146 | :path => "/projects/ecookbook/issues/234/time_entries.csv" }, | |
147 | { :controller => 'timelog', :action => 'index', |
|
147 | { :controller => 'timelog', :action => 'index', | |
148 | :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' } |
|
148 | :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' } | |
149 | ) |
|
149 | ) | |
150 | assert_routing( |
|
150 | assert_routing( | |
151 | { :method => 'get', |
|
151 | { :method => 'get', | |
152 | :path => "/projects/ecookbook/issues/234/time_entries.atom" }, |
|
152 | :path => "/projects/ecookbook/issues/234/time_entries.atom" }, | |
153 | { :controller => 'timelog', :action => 'index', |
|
153 | { :controller => 'timelog', :action => 'index', | |
154 | :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' } |
|
154 | :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' } | |
155 | ) |
|
155 | ) | |
156 | assert_routing( |
|
156 | assert_routing( | |
157 | { :method => 'get', |
|
157 | { :method => 'get', | |
158 | :path => "/projects/ecookbook/issues/234/time_entries/new" }, |
|
158 | :path => "/projects/ecookbook/issues/234/time_entries/new" }, | |
159 | { :controller => 'timelog', :action => 'new', |
|
159 | { :controller => 'timelog', :action => 'new', | |
160 | :issue_id => '234', :project_id => 'ecookbook' } |
|
160 | :issue_id => '234', :project_id => 'ecookbook' } | |
161 | ) |
|
161 | ) | |
162 | assert_routing( |
|
162 | assert_routing( | |
163 | { :method => 'get', |
|
163 | { :method => 'get', | |
164 | :path => "/projects/ecookbook/issues/234/time_entries/22/edit" }, |
|
164 | :path => "/projects/ecookbook/issues/234/time_entries/22/edit" }, | |
165 | { :controller => 'timelog', :action => 'edit', :id => '22', |
|
165 | { :controller => 'timelog', :action => 'edit', :id => '22', | |
166 | :issue_id => '234', :project_id => 'ecookbook' } |
|
166 | :issue_id => '234', :project_id => 'ecookbook' } | |
167 | ) |
|
167 | ) | |
168 | assert_routing( |
|
168 | assert_routing( | |
169 | { :method => 'post', |
|
169 | { :method => 'post', | |
170 | :path => "/projects/ecookbook/issues/234/time_entries" }, |
|
170 | :path => "/projects/ecookbook/issues/234/time_entries" }, | |
171 | { :controller => 'timelog', :action => 'create', |
|
171 | { :controller => 'timelog', :action => 'create', | |
172 | :issue_id => '234', :project_id => 'ecookbook' } |
|
172 | :issue_id => '234', :project_id => 'ecookbook' } | |
173 | ) |
|
173 | ) | |
174 | assert_routing( |
|
174 | assert_routing( | |
175 | { :method => 'put', |
|
175 | { :method => 'put', | |
176 | :path => "/projects/ecookbook/issues/234/time_entries/22" }, |
|
176 | :path => "/projects/ecookbook/issues/234/time_entries/22" }, | |
177 | { :controller => 'timelog', :action => 'update', :id => '22', |
|
177 | { :controller => 'timelog', :action => 'update', :id => '22', | |
178 | :issue_id => '234', :project_id => 'ecookbook' } |
|
178 | :issue_id => '234', :project_id => 'ecookbook' } | |
179 | ) |
|
179 | ) | |
180 | assert_routing( |
|
180 | assert_routing( | |
181 | { :method => 'delete', |
|
181 | { :method => 'delete', | |
182 | :path => "/projects/ecookbook/issues/234/time_entries/55" }, |
|
182 | :path => "/projects/ecookbook/issues/234/time_entries/55" }, | |
183 | { :controller => 'timelog', :action => 'destroy', :id => '55', |
|
183 | { :controller => 'timelog', :action => 'destroy', :id => '55', | |
184 | :issue_id => '234', :project_id => 'ecookbook' } |
|
184 | :issue_id => '234', :project_id => 'ecookbook' } | |
185 | ) |
|
185 | ) | |
186 | assert_routing( |
|
186 | assert_routing( | |
187 | { :method => 'get', |
|
187 | { :method => 'get', | |
188 | :path => "/time_entries/report" }, |
|
188 | :path => "/time_entries/report" }, | |
189 | { :controller => 'timelog', :action => 'report' } |
|
189 | { :controller => 'timelog', :action => 'report' } | |
190 | ) |
|
190 | ) | |
191 | assert_routing( |
|
191 | assert_routing( | |
192 | { :method => 'get', |
|
192 | { :method => 'get', | |
193 | :path => "/projects/567/time_entries/report" }, |
|
193 | :path => "/projects/567/time_entries/report" }, | |
194 | { :controller => 'timelog', :action => 'report', :project_id => '567' } |
|
194 | { :controller => 'timelog', :action => 'report', :project_id => '567' } | |
195 | ) |
|
195 | ) | |
196 | assert_routing( |
|
196 | assert_routing( | |
197 | { :method => 'get', |
|
197 | { :method => 'get', | |
198 | :path => "/projects/567/time_entries/report.csv" }, |
|
198 | :path => "/projects/567/time_entries/report.csv" }, | |
199 | { :controller => 'timelog', :action => 'report', :project_id => '567', |
|
199 | { :controller => 'timelog', :action => 'report', :project_id => '567', | |
200 | :format => 'csv' } |
|
200 | :format => 'csv' } | |
201 | ) |
|
201 | ) | |
202 | end |
|
202 | end | |
|
203 | ||||
|
204 | def test_timelogs_bulk_edit | |||
|
205 | assert_routing( | |||
|
206 | { :method => 'delete', | |||
|
207 | :path => "/time_entries/destroy" }, | |||
|
208 | { :controller => 'timelog', :action => 'destroy' } | |||
|
209 | ) | |||
|
210 | assert_routing( | |||
|
211 | { :method => 'post', | |||
|
212 | :path => "/time_entries/bulk_update" }, | |||
|
213 | { :controller => 'timelog', :action => 'bulk_update' } | |||
|
214 | ) | |||
|
215 | assert_routing( | |||
|
216 | { :method => 'get', | |||
|
217 | :path => "/time_entries/bulk_edit" }, | |||
|
218 | { :controller => 'timelog', :action => 'bulk_edit' } | |||
|
219 | ) | |||
|
220 | end | |||
203 | end |
|
221 | end |
General Comments 0
You need to be logged in to leave comments.
Login now