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