comparison .svn/pristine/fc/fc770db4db5a22614ed5ce3040fd496687aca860.svn-base @ 1298:4f746d8966dd redmine_2.3_integration

Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author Chris Cannam
date Fri, 14 Jun 2013 09:28:30 +0100
parents 622f24f53b42
children
comparison
equal deleted inserted replaced
1297:0a574315af3e 1298:4f746d8966dd
1 # Redmine - project management software
2 # Copyright (C) 2006-2013 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 end
187
188 def test_timelogs_report
189 assert_routing(
190 { :method => 'get',
191 :path => "/time_entries/report" },
192 { :controller => 'timelog', :action => 'report' }
193 )
194 assert_routing(
195 { :method => 'get',
196 :path => "/time_entries/report.csv" },
197 { :controller => 'timelog', :action => 'report', :format => 'csv' }
198 )
199 assert_routing(
200 { :method => 'get',
201 :path => "/issues/234/time_entries/report" },
202 { :controller => 'timelog', :action => 'report', :issue_id => '234' }
203 )
204 assert_routing(
205 { :method => 'get',
206 :path => "/issues/234/time_entries/report.csv" },
207 { :controller => 'timelog', :action => 'report', :issue_id => '234',
208 :format => 'csv' }
209 )
210 assert_routing(
211 { :method => 'get',
212 :path => "/projects/567/time_entries/report" },
213 { :controller => 'timelog', :action => 'report', :project_id => '567' }
214 )
215 assert_routing(
216 { :method => 'get',
217 :path => "/projects/567/time_entries/report.csv" },
218 { :controller => 'timelog', :action => 'report', :project_id => '567',
219 :format => 'csv' }
220 )
221 end
222
223 def test_timelogs_bulk_edit
224 assert_routing(
225 { :method => 'delete',
226 :path => "/time_entries/destroy" },
227 { :controller => 'timelog', :action => 'destroy' }
228 )
229 assert_routing(
230 { :method => 'post',
231 :path => "/time_entries/bulk_update" },
232 { :controller => 'timelog', :action => 'bulk_update' }
233 )
234 assert_routing(
235 { :method => 'get',
236 :path => "/time_entries/bulk_edit" },
237 { :controller => 'timelog', :action => 'bulk_edit' }
238 )
239 end
240 end