##// END OF EJS Templates
Fixed broken issue form update when changing tracker....
Jean-Philippe Lang -
r8075:ed5f487cf507
parent child
Show More
@@ -1,46 +1,46
1 1 <%= call_hook(:view_issues_form_details_top, { :issue => @issue, :form => f }) %>
2 2
3 3 <% if @issue.safe_attribute_names.include?('is_private') %>
4 4 <p style="float:right; margin-right:1em;">
5 5 <label class="inline" for="issue_is_private" id="issue_is_private_label"><%= f.check_box :is_private, :no_label => true %> <%= l(:field_is_private) %></label>
6 6 </p>
7 7 <% end %>
8 8 <p><%= f.select :tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true %></p>
9 <%= observe_field :issue_tracker_id, :url => { :action => :new, :project_id => @project, :id => @issue },
9 <%= observe_field :issue_tracker_id, :url => project_issue_form_path(@project, :id => @issue),
10 10 :update => :attributes,
11 11 :with => "Form.serialize('issue-form')" %>
12 12
13 13 <p><%= f.text_field :subject, :size => 80, :required => true %></p>
14 14 <p>
15 15 <label><%= l(:field_description) %></label>
16 16 <%= link_to_function image_tag('edit.png'),
17 17 'Element.hide(this); Effect.toggle("issue_description_and_toolbar", "appear", {duration:0.3})' unless @issue.new_record? %>
18 18 <% content_tag 'span', :id => "issue_description_and_toolbar", :style => (@issue.new_record? ? nil : 'display:none') do %>
19 19 <%= f.text_area :description,
20 20 :cols => 60,
21 21 :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
22 22 :accesskey => accesskey(:edit),
23 23 :class => 'wiki-edit',
24 24 :no_label => true %>
25 25 <% end %>
26 26 </p>
27 27
28 28 <div id="attributes" class="attributes">
29 29 <%= render :partial => 'issues/attributes' %>
30 30 </div>
31 31
32 32 <% if @issue.new_record? %>
33 33 <p id="attachments_form"><%= label_tag('attachments[1][file]', l(:label_attachment_plural))%><%= render :partial => 'attachments/form' %></p>
34 34 <% end %>
35 35
36 36 <% if @issue.new_record? && User.current.allowed_to?(:add_issue_watchers, @project) -%>
37 37 <p id="watchers_form"><label><%= l(:label_issue_watchers) %></label>
38 38 <% @issue.project.users.sort.each do |user| -%>
39 39 <label class="floating"><%= check_box_tag 'issue[watcher_user_ids][]', user.id, @issue.watched_by?(user) %> <%=h user %></label>
40 40 <% end -%>
41 41 </p>
42 42 <% end %>
43 43
44 44 <%= call_hook(:view_issues_form_details_bottom, { :issue => @issue, :form => f }) %>
45 45
46 46 <%= wikitoolbar_for 'issue_description' %>
@@ -1,262 +1,265
1 1 ActionController::Routing::Routes.draw do |map|
2 2 # Add your own custom routes here.
3 3 # The priority is based upon order of creation: first created -> highest priority.
4 4
5 5 # Here's a sample route:
6 6 # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
7 7 # Keep in mind you can assign values other than :controller and :action
8 8
9 9 map.home '', :controller => 'welcome', :conditions => {:method => :get}
10 10
11 11 map.signin 'login', :controller => 'account', :action => 'login', :conditions => {:method => [:get, :post]}
12 12 map.signout 'logout', :controller => 'account', :action => 'logout', :conditions => {:method => :get}
13 13 map.connect 'account/register', :controller => 'account', :action => 'register', :conditions => {:method => [:get, :post]}
14 14 map.connect 'account/lost_password', :controller => 'account', :action => 'lost_password', :conditions => {:method => [:get, :post]}
15 15 map.connect 'account/activate', :controller => 'account', :action => 'activate', :conditions => {:method => :get}
16 16
17 17 map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
18 18
19 19 map.connect 'help/:ctrl/:page', :controller => 'help', :conditions => {:method => :get}
20 20
21 21 map.connect '/time_entries/destroy',
22 22 :controller => 'timelog', :action => 'destroy', :conditions => { :method => :delete }
23 23 map.time_entries_context_menu '/time_entries/context_menu',
24 24 :controller => 'context_menus', :action => 'time_entries'
25 25
26 26 map.resources :time_entries, :controller => 'timelog', :collection => {:report => :get, :bulk_edit => :get, :bulk_update => :post}
27 27
28 28 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
29 29 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => [:get, :post]}
30 30
31 31 map.with_options :controller => 'messages' do |messages_routes|
32 32 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
33 33 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
34 34 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
35 35 messages_views.connect 'boards/:board_id/topics/quote/:id', :action => 'quote'
36 36 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
37 37 end
38 38 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
39 39 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
40 40 messages_actions.connect 'boards/:board_id/topics/preview', :action => 'preview'
41 41 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
42 42 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
43 43 end
44 44 end
45 45
46 46 map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move'
47 47 map.resources :queries, :except => [:show]
48 48
49 49 # Misc issue routes. TODO: move into resources
50 50 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues', :conditions => { :method => :get }
51 51 map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview
52 52 map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
53 53 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
54 54 map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
55 55
56 56 map.connect '/journals/diff/:id', :controller => 'journals', :action => 'diff', :id => /\d+/, :conditions => { :method => :get }
57 57 map.connect '/journals/edit/:id', :controller => 'journals', :action => 'edit', :id => /\d+/, :conditions => { :method => [:get, :post] }
58 58
59 59 map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes|
60 60 gantts_routes.connect '/projects/:project_id/issues/gantt'
61 61 gantts_routes.connect '/projects/:project_id/issues/gantt.:format'
62 62 gantts_routes.connect '/issues/gantt.:format'
63 63 end
64 64
65 65 map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes|
66 66 calendars_routes.connect '/projects/:project_id/issues/calendar'
67 67 calendars_routes.connect '/issues/calendar'
68 68 end
69 69
70 70 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
71 71 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
72 72 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
73 73 end
74 74
75 75 map.connect 'my/account', :controller => 'my', :action => 'account', :conditions => {:method => [:get, :post]}
76 76 map.connect 'my/page', :controller => 'my', :action => 'page', :conditions => {:method => :get}
77 77 map.connect 'my', :controller => 'my', :action => 'index', :conditions => {:method => :get} # Redirects to my/page
78 78 map.connect 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :conditions => {:method => :post}
79 79 map.connect 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :conditions => {:method => :post}
80 80 map.connect 'my/password', :controller => 'my', :action => 'password', :conditions => {:method => [:get, :post]}
81 81 map.connect 'my/page_layout', :controller => 'my', :action => 'page_layout', :conditions => {:method => :get}
82 82 map.connect 'my/add_block', :controller => 'my', :action => 'add_block', :conditions => {:method => :post}
83 83 map.connect 'my/remove_block', :controller => 'my', :action => 'remove_block', :conditions => {:method => :post}
84 84 map.connect 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :conditions => {:method => :post}
85 85
86 86 map.resources :issues, :collection => {:bulk_edit => :get, :bulk_update => :post} do |issues|
87 87 issues.resources :time_entries, :controller => 'timelog', :collection => {:report => :get}
88 88 issues.resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
89 89 end
90 90 # Bulk deletion
91 91 map.connect '/issues', :controller => 'issues', :action => 'destroy', :conditions => {:method => :delete}
92 92
93 93 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new', :conditions => { :method => :post }
94 94 map.connect 'members/edit/:id', :controller => 'members', :action => 'edit', :id => /\d+/, :conditions => { :method => :post }
95 95 map.connect 'members/destroy/:id', :controller => 'members', :action => 'destroy', :id => /\d+/, :conditions => { :method => :post }
96 96 map.connect 'members/autocomplete_for_member/:id', :controller => 'members', :action => 'autocomplete_for_member', :conditions => { :method => :post }
97 97
98 98 map.resources :users
99 99 map.with_options :controller => 'users' do |users|
100 100 users.user_memberships 'users/:id/memberships', :action => 'edit_membership', :conditions => {:method => :post}
101 101 users.user_membership 'users/:id/memberships/:membership_id', :action => 'edit_membership', :conditions => {:method => :put}
102 102 users.connect 'users/:id/memberships/:membership_id', :action => 'destroy_membership', :conditions => {:method => :delete}
103 103 end
104 104
105 105 # For nice "roadmap" in the url for the index action
106 106 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
107 107
108 108 map.all_news 'news', :controller => 'news', :action => 'index'
109 109 map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index'
110 110 map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
111 111 map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post}
112 112 map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete}
113 113
114 114 map.connect 'watchers/new', :controller=> 'watchers', :action => 'new', :conditions => {:method => [:get, :post]}
115 115 map.connect 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', :conditions => {:method => :post}
116 116 map.connect 'watchers/watch', :controller=> 'watchers', :action => 'watch', :conditions => {:method => :post}
117 117 map.connect 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', :conditions => {:method => :post}
118 118
119 119 map.resources :projects, :member => {
120 120 :copy => [:get, :post],
121 121 :settings => :get,
122 122 :modules => :post,
123 123 :archive => :post,
124 124 :unarchive => :post
125 125 } do |project|
126 126 project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
127 127 project.resources :issues, :only => [:index, :new, :create] do |issues|
128 128 issues.resources :time_entries, :controller => 'timelog', :collection => {:report => :get}
129 129 end
130 # issue form update
131 project.issue_form 'issues/new', :controller => 'issues', :action => 'new', :conditions => {:method => :post}
132
130 133 project.resources :files, :only => [:index, :new, :create]
131 134 project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post}
132 135 project.resources :news, :shallow => true
133 136 project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id', :collection => {:report => :get}
134 137 project.resources :queries, :only => [:new, :create]
135 138 project.resources :issue_categories, :shallow => true
136 139 project.resources :documents, :shallow => true, :member => {:add_attachment => :post}
137 140 project.resources :boards
138 141
139 142 project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
140 143 project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
141 144 project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
142 145 project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
143 146 project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
144 147 project.resources :wiki, :except => [:new, :create], :member => {
145 148 :rename => [:get, :post],
146 149 :history => :get,
147 150 :preview => :any,
148 151 :protect => :post,
149 152 :add_attachment => :post
150 153 }, :collection => {
151 154 :export => :get,
152 155 :date_index => :get
153 156 }
154 157
155 158 end
156 159
157 160 # TODO: port to be part of the resources route(s)
158 161 map.with_options :controller => 'projects' do |project_mapper|
159 162 project_mapper.with_options :conditions => {:method => :get} do |project_views|
160 163 project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings'
161 164 project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new'
162 165 end
163 166 end
164 167
165 168 map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity|
166 169 activity.connect 'projects/:id/activity'
167 170 activity.connect 'projects/:id/activity.:format'
168 171 activity.connect 'activity', :id => nil
169 172 activity.connect 'activity.:format', :id => nil
170 173 end
171 174
172 175 map.with_options :controller => 'repositories' do |repositories|
173 176 repositories.with_options :conditions => {:method => :get} do |repository_views|
174 177 repository_views.connect 'projects/:id/repository', :action => 'show'
175 178 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
176 179 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
177 180 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
178 181 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
179 182 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
180 183 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
181 184 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
182 185 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
183 186 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
184 187 repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
185 188 repository_views.connect 'projects/:id/repository/browse/*path', :action => 'browse'
186 189 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
187 190 repository_views.connect 'projects/:id/repository/changes/*path', :action => 'changes'
188 191 repository_views.connect 'projects/:id/repository/annotate/*path', :action => 'annotate'
189 192 repository_views.connect 'projects/:id/repository/diff/*path', :action => 'diff'
190 193 repository_views.connect 'projects/:id/repository/graph', :action => 'graph'
191 194 end
192 195
193 196 repositories.connect 'projects/:id/repository/revision', :action => 'revision', :conditions => {:method => [:get, :post]}
194 197 repositories.connect 'projects/:id/repository/committers', :action => 'committers', :conditions => {:method => [:get, :post]}
195 198 repositories.connect 'projects/:id/repository/edit', :action => 'edit', :conditions => {:method => :post}
196 199 repositories.connect 'projects/:id/repository/destroy', :action => 'destroy', :conditions => {:method => :post}
197 200 end
198 201
199 202 map.resources :attachments, :only => [:show, :destroy]
200 203 # additional routes for having the file name at the end of url
201 204 map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :conditions => {:method => :get}
202 205 map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :conditions => {:method => :get}
203 206 map.connect 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :conditions => {:method => :get}
204 207
205 208 map.resources :groups, :member => {:autocomplete_for_user => :get}
206 209 map.group_users 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :conditions => {:method => :post}
207 210 map.group_user 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :conditions => {:method => :delete}
208 211 map.connect 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :conditions => {:method => :post}
209 212 map.connect 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :conditions => {:method => :post}
210 213
211 214 map.resources :trackers, :except => :show
212 215 map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post}
213 216 map.resources :custom_fields, :except => :show
214 217 map.resources :roles, :except => :show, :collection => {:permissions => [:get, :post]}
215 218 map.resources :enumerations, :except => :show
216 219
217 220 map.connect 'search', :controller => 'search', :action => 'index', :conditions => {:method => :get}
218 221
219 222 map.connect 'mail_handler', :controller => 'mail_handler', :action => 'index', :conditions => {:method => :post}
220 223
221 224 map.connect 'admin', :controller => 'admin', :action => 'index', :conditions => {:method => :get}
222 225 map.connect 'admin/projects', :controller => 'admin', :action => 'projects', :conditions => {:method => :get}
223 226 map.connect 'admin/plugins', :controller => 'admin', :action => 'plugins', :conditions => {:method => :get}
224 227 map.connect 'admin/info', :controller => 'admin', :action => 'info', :conditions => {:method => :get}
225 228 map.connect 'admin/test_email', :controller => 'admin', :action => 'test_email', :conditions => {:method => :get}
226 229 map.connect 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :conditions => {:method => :post}
227 230
228 231 # Used by AuthSourcesControllerTest
229 232 # TODO : refactor *AuthSourcesController to remove these routes
230 233 map.connect 'auth_sources', :controller => 'auth_sources', :action => 'index', :conditions => {:method => :get}
231 234 map.connect 'auth_sources/new', :controller => 'auth_sources', :action => 'new', :conditions => {:method => :get}
232 235 map.connect 'auth_sources/create', :controller => 'auth_sources', :action => 'create', :conditions => {:method => :post}
233 236 map.connect 'auth_sources/destroy/:id', :controller => 'auth_sources', :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
234 237 map.connect 'auth_sources/test_connection/:id', :controller => 'auth_sources', :action => 'test_connection', :conditions => {:method => :get}
235 238 map.connect 'auth_sources/edit/:id', :controller => 'auth_sources', :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
236 239 map.connect 'auth_sources/update/:id', :controller => 'auth_sources', :action => 'update', :id => /\d+/, :conditions => {:method => :post}
237 240
238 241 map.connect 'ldap_auth_sources', :controller => 'ldap_auth_sources', :action => 'index', :conditions => {:method => :get}
239 242 map.connect 'ldap_auth_sources/new', :controller => 'ldap_auth_sources', :action => 'new', :conditions => {:method => :get}
240 243 map.connect 'ldap_auth_sources/create', :controller => 'ldap_auth_sources', :action => 'create', :conditions => {:method => :post}
241 244 map.connect 'ldap_auth_sources/destroy/:id', :controller => 'ldap_auth_sources', :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
242 245 map.connect 'ldap_auth_sources/test_connection/:id', :controller => 'ldap_auth_sources', :action => 'test_connection', :conditions => {:method => :get}
243 246 map.connect 'ldap_auth_sources/edit/:id', :controller => 'ldap_auth_sources', :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
244 247 map.connect 'ldap_auth_sources/update/:id', :controller => 'ldap_auth_sources', :action => 'update', :id => /\d+/, :conditions => {:method => :post}
245 248 map.connect 'workflows', :controller => 'workflows', :action => 'index', :conditions => {:method => :get}
246 249 map.connect 'workflows/edit', :controller => 'workflows', :action => 'edit', :conditions => {:method => [:get, :post]}
247 250 map.connect 'workflows/copy', :controller => 'workflows', :action => 'copy', :conditions => {:method => [:get, :post]}
248 251 map.connect 'settings', :controller => 'settings', :action => 'index', :conditions => {:method => :get}
249 252 map.connect 'settings/edit', :controller => 'settings', :action => 'edit', :conditions => {:method => [:get, :post]}
250 253 map.connect 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :conditions => {:method => [:get, :post]}
251 254
252 255 map.with_options :controller => 'sys' do |sys|
253 256 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
254 257 sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
255 258 sys.connect 'sys/fetch_changesets', :action => 'fetch_changesets', :conditions => {:method => :get}
256 259 end
257 260
258 261 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots', :conditions => {:method => :get}
259 262
260 263 # Used for OpenID
261 264 map.root :controller => 'account', :action => 'login'
262 265 end
@@ -1,200 +1,209
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 IssuesTest < ActionController::IntegrationTest
21 21 fixtures :projects,
22 22 :users,
23 23 :roles,
24 24 :members,
25 25 :trackers,
26 26 :projects_trackers,
27 27 :enabled_modules,
28 28 :issue_statuses,
29 29 :issues,
30 30 :enumerations,
31 31 :custom_fields,
32 32 :custom_values,
33 33 :custom_fields_trackers
34 34
35 35 # create an issue
36 36 def test_add_issue
37 37 log_user('jsmith', 'jsmith')
38 38 get 'projects/1/issues/new', :tracker_id => '1'
39 39 assert_response :success
40 40 assert_template 'issues/new'
41 41
42 42 post 'projects/1/issues', :tracker_id => "1",
43 43 :issue => { :start_date => "2006-12-26",
44 44 :priority_id => "4",
45 45 :subject => "new test issue",
46 46 :category_id => "",
47 47 :description => "new issue",
48 48 :done_ratio => "0",
49 49 :due_date => "",
50 50 :assigned_to_id => "" },
51 51 :custom_fields => {'2' => 'Value for field 2'}
52 52 # find created issue
53 53 issue = Issue.find_by_subject("new test issue")
54 54 assert_kind_of Issue, issue
55 55
56 56 # check redirection
57 57 assert_redirected_to :controller => 'issues', :action => 'show', :id => issue
58 58 follow_redirect!
59 59 assert_equal issue, assigns(:issue)
60 60
61 61 # check issue attributes
62 62 assert_equal 'jsmith', issue.author.login
63 63 assert_equal 1, issue.project.id
64 64 assert_equal 1, issue.status.id
65 65 end
66 66
67 def test_update_issue_form
68 log_user('jsmith', 'jsmith')
69 post 'projects/ecookbook/issues/new', :issue => { :tracker_id => "2"}
70 assert_response :success
71 assert_tag 'select',
72 :attributes => {:name => 'issue[tracker_id]'},
73 :child => {:tag => 'option', :attributes => {:value => '2', :selected => 'selected'}}
74 end
75
67 76 # add then remove 2 attachments to an issue
68 77 def test_issue_attachments
69 78 log_user('jsmith', 'jsmith')
70 79 set_tmp_attachments_directory
71 80
72 81 put 'issues/1',
73 82 :notes => 'Some notes',
74 83 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}
75 84 assert_redirected_to "/issues/1"
76 85
77 86 # make sure attachment was saved
78 87 attachment = Issue.find(1).attachments.find_by_filename("testfile.txt")
79 88 assert_kind_of Attachment, attachment
80 89 assert_equal Issue.find(1), attachment.container
81 90 assert_equal 'This is an attachment', attachment.description
82 91 # verify the size of the attachment stored in db
83 92 #assert_equal file_data_1.length, attachment.filesize
84 93 # verify that the attachment was written to disk
85 94 assert File.exist?(attachment.diskfile)
86 95
87 96 # remove the attachments
88 97 Issue.find(1).attachments.each(&:destroy)
89 98 assert_equal 0, Issue.find(1).attachments.length
90 99 end
91 100
92 101 def test_other_formats_links_on_index
93 102 get '/projects/ecookbook/issues'
94 103
95 104 %w(Atom PDF CSV).each do |format|
96 105 assert_tag :a, :content => format,
97 106 :attributes => { :href => "/projects/ecookbook/issues.#{format.downcase}",
98 107 :rel => 'nofollow' }
99 108 end
100 109 end
101 110
102 111 def test_other_formats_links_on_index_without_project_id_in_url
103 112 get '/issues', :project_id => 'ecookbook'
104 113
105 114 %w(Atom PDF CSV).each do |format|
106 115 assert_tag :a, :content => format,
107 116 :attributes => { :href => "/projects/ecookbook/issues.#{format.downcase}",
108 117 :rel => 'nofollow' }
109 118 end
110 119 end
111 120
112 121 def test_pagination_links_on_index
113 122 Setting.per_page_options = '2'
114 123 get '/projects/ecookbook/issues'
115 124
116 125 assert_tag :a, :content => '2',
117 126 :attributes => { :href => '/projects/ecookbook/issues?page=2' }
118 127
119 128 end
120 129
121 130 def test_pagination_links_on_index_without_project_id_in_url
122 131 Setting.per_page_options = '2'
123 132 get '/issues', :project_id => 'ecookbook'
124 133
125 134 assert_tag :a, :content => '2',
126 135 :attributes => { :href => '/projects/ecookbook/issues?page=2' }
127 136
128 137 end
129 138
130 139 def test_issue_with_user_custom_field
131 140 @field = IssueCustomField.create!(:name => 'Tester', :field_format => 'user', :is_for_all => true, :trackers => Tracker.all)
132 141 Role.anonymous.add_permission! :add_issues, :edit_issues
133 142 users = Project.find(1).users
134 143 tester = users.first
135 144
136 145 # Issue form
137 146 get '/projects/ecookbook/issues/new'
138 147 assert_response :success
139 148 assert_tag :select,
140 149 :attributes => {:name => "issue[custom_field_values][#{@field.id}]"},
141 150 :children => {:count => (users.size + 1)}, # +1 for blank value
142 151 :child => {
143 152 :tag => 'option',
144 153 :attributes => {:value => tester.id.to_s},
145 154 :content => tester.name
146 155 }
147 156
148 157 # Create issue
149 158 assert_difference 'Issue.count' do
150 159 post '/projects/ecookbook/issues',
151 160 :issue => {
152 161 :tracker_id => '1',
153 162 :priority_id => '4',
154 163 :subject => 'Issue with user custom field',
155 164 :custom_field_values => {@field.id.to_s => users.first.id.to_s}
156 165 }
157 166 end
158 167 issue = Issue.first(:order => 'id DESC')
159 168 assert_response 302
160 169
161 170 # Issue view
162 171 follow_redirect!
163 172 assert_tag :th,
164 173 :content => /Tester/,
165 174 :sibling => {
166 175 :tag => 'td',
167 176 :content => tester.name
168 177 }
169 178 assert_tag :select,
170 179 :attributes => {:name => "issue[custom_field_values][#{@field.id}]"},
171 180 :children => {:count => (users.size + 1)}, # +1 for blank value
172 181 :child => {
173 182 :tag => 'option',
174 183 :attributes => {:value => tester.id.to_s, :selected => 'selected'},
175 184 :content => tester.name
176 185 }
177 186
178 187 # Update issue
179 188 new_tester = users[1]
180 189 assert_difference 'Journal.count' do
181 190 put "/issues/#{issue.id}",
182 191 :notes => 'Updating custom field',
183 192 :issue => {
184 193 :custom_field_values => {@field.id.to_s => new_tester.id.to_s}
185 194 }
186 195 end
187 196 assert_response 302
188 197
189 198 # Issue view
190 199 follow_redirect!
191 200 assert_tag :content => 'Tester',
192 201 :ancestor => {:tag => 'ul', :attributes => {:class => /details/}},
193 202 :sibling => {
194 203 :content => tester.name,
195 204 :sibling => {
196 205 :content => new_tester.name
197 206 }
198 207 }
199 208 end
200 209 end
@@ -1,456 +1,458
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 21 context "activities" do
22 22 should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil
23 23 should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom'
24 24 end
25 25
26 26 context "attachments" do
27 27 should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1'
28 28 should_route :get, "/attachments/1.xml", :controller => 'attachments', :action => 'show', :id => '1', :format => 'xml'
29 29 should_route :get, "/attachments/1.json", :controller => 'attachments', :action => 'show', :id => '1', :format => 'json'
30 30 should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext'
31 31 should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1'
32 32 should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext'
33 33 end
34 34
35 35 context "boards" do
36 36 should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination'
37 37 should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination'
38 38 should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44'
39 39 should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom'
40 40 should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44'
41 41
42 42 should_route :post, "/projects/world_domination/boards", :controller => 'boards', :action => 'create', :project_id => 'world_domination'
43 43 should_route :put, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'update', :project_id => 'world_domination', :id => '44'
44 44 should_route :delete, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44'
45 45
46 46 end
47 47
48 48 context "custom_fields" do
49 49 should_route :get, "/custom_fields", :controller => 'custom_fields', :action => 'index'
50 50 should_route :get, "/custom_fields/new", :controller => 'custom_fields', :action => 'new'
51 51 should_route :post, "/custom_fields", :controller => 'custom_fields', :action => 'create'
52 52 should_route :get, "/custom_fields/2/edit", :controller => 'custom_fields', :action => 'edit', :id => 2
53 53 should_route :put, "/custom_fields/2", :controller => 'custom_fields', :action => 'update', :id => 2
54 54 should_route :delete, "/custom_fields/2", :controller => 'custom_fields', :action => 'destroy', :id => 2
55 55 end
56 56
57 57 context "documents" do
58 58 should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567'
59 59 should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
60 60 should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22'
61 61 should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22'
62 62
63 63 should_route :post, "/projects/567/documents", :controller => 'documents', :action => 'create', :project_id => '567'
64 64 should_route :put, "/documents/22", :controller => 'documents', :action => 'update', :id => '22'
65 65 should_route :delete, "/documents/22", :controller => 'documents', :action => 'destroy', :id => '22'
66 66
67 67 should_route :post, "/documents/22/add_attachment", :controller => 'documents', :action => 'add_attachment', :id => '22'
68 68 end
69 69
70 70 context "roles" do
71 71 should_route :get, "/enumerations", :controller => 'enumerations', :action => 'index'
72 72 should_route :get, "/enumerations/new", :controller => 'enumerations', :action => 'new'
73 73 should_route :post, "/enumerations", :controller => 'enumerations', :action => 'create'
74 74 should_route :get, "/enumerations/2/edit", :controller => 'enumerations', :action => 'edit', :id => 2
75 75 should_route :put, "/enumerations/2", :controller => 'enumerations', :action => 'update', :id => 2
76 76 should_route :delete, "/enumerations/2", :controller => 'enumerations', :action => 'destroy', :id => 2
77 77 end
78 78
79 79 context "groups" do
80 80 should_route :post, "/groups/567/users", :controller => 'groups', :action => 'add_users', :id => '567'
81 81 should_route :delete, "/groups/567/users/12", :controller => 'groups', :action => 'remove_user', :id => '567', :user_id => '12'
82 82 end
83 83
84 84 context "issues" do
85 85 # REST actions
86 86 should_route :get, "/issues", :controller => 'issues', :action => 'index'
87 87 should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf'
88 88 should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom'
89 89 should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml'
90 90 should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23'
91 91 should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf'
92 92 should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom'
93 93 should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml'
94 94 should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64'
95 95 should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf'
96 96 should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom'
97 97 should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml'
98 98
99 99 should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
100 # issue form update
101 should_route :post, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
100 102 should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23'
101 103 should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml'
102 104
103 105 should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
104 106 should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml'
105 107
106 108 should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml'
107 109
108 110 # Extra actions
109 111 should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64'
110 112
111 113 should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new'
112 114 should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create'
113 115
114 116 should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1'
115 117
116 118 should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show'
117 119 should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name'
118 120
119 121 should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show'
120 122 should_route :get, "/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :format => 'pdf'
121 123 should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name'
122 124 should_route :get, "/projects/project-name/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :project_id => 'project-name', :format => 'pdf'
123 125
124 126 should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues'
125 127
126 128 should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
127 129 should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
128 130 should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
129 131 should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
130 132
131 133 should_route :get, "/issues/changes", :controller => 'journals', :action => 'index'
132 134
133 135 should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit'
134 136 should_route :post, "/issues/bulk_update", :controller => 'issues', :action => 'bulk_update'
135 137 end
136 138
137 139 context "issue categories" do
138 140 should_route :get, "/projects/foo/issue_categories", :controller => 'issue_categories', :action => 'index', :project_id => 'foo'
139 141 should_route :get, "/projects/foo/issue_categories.xml", :controller => 'issue_categories', :action => 'index', :project_id => 'foo', :format => 'xml'
140 142 should_route :get, "/projects/foo/issue_categories.json", :controller => 'issue_categories', :action => 'index', :project_id => 'foo', :format => 'json'
141 143
142 144 should_route :get, "/projects/foo/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'foo'
143 145
144 146 should_route :post, "/projects/foo/issue_categories", :controller => 'issue_categories', :action => 'create', :project_id => 'foo'
145 147 should_route :post, "/projects/foo/issue_categories.xml", :controller => 'issue_categories', :action => 'create', :project_id => 'foo', :format => 'xml'
146 148 should_route :post, "/projects/foo/issue_categories.json", :controller => 'issue_categories', :action => 'create', :project_id => 'foo', :format => 'json'
147 149
148 150 should_route :get, "/issue_categories/1", :controller => 'issue_categories', :action => 'show', :id => '1'
149 151 should_route :get, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'show', :id => '1', :format => 'xml'
150 152 should_route :get, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'show', :id => '1', :format => 'json'
151 153
152 154 should_route :get, "/issue_categories/1/edit", :controller => 'issue_categories', :action => 'edit', :id => '1'
153 155
154 156 should_route :put, "/issue_categories/1", :controller => 'issue_categories', :action => 'update', :id => '1'
155 157 should_route :put, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'update', :id => '1', :format => 'xml'
156 158 should_route :put, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'update', :id => '1', :format => 'json'
157 159
158 160 should_route :delete, "/issue_categories/1", :controller => 'issue_categories', :action => 'destroy', :id => '1'
159 161 should_route :delete, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'xml'
160 162 should_route :delete, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'json'
161 163 end
162 164
163 165 context "issue relations" do
164 166 should_route :get, "/issues/1/relations", :controller => 'issue_relations', :action => 'index', :issue_id => '1'
165 167 should_route :get, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'xml'
166 168 should_route :get, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'json'
167 169
168 170 should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'create', :issue_id => '1'
169 171 should_route :post, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'xml'
170 172 should_route :post, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'json'
171 173
172 174 should_route :get, "/relations/23", :controller => 'issue_relations', :action => 'show', :id => '23'
173 175 should_route :get, "/relations/23.xml", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'xml'
174 176 should_route :get, "/relations/23.json", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'json'
175 177
176 178 should_route :delete, "/relations/23", :controller => 'issue_relations', :action => 'destroy', :id => '23'
177 179 should_route :delete, "/relations/23.xml", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'xml'
178 180 should_route :delete, "/relations/23.json", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'json'
179 181 end
180 182
181 183 context "issue reports" do
182 184 should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
183 185 should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to'
184 186 end
185 187
186 188 context "members" do
187 189 should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234'
188 190 end
189 191
190 192 context "messages" do
191 193 should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22'
192 194 should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
193 195 should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
194 196
195 197 should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
196 198 should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
197 199 should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22'
198 200 should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22'
199 201 end
200 202
201 203 context "news" do
202 204 should_route :get, "/news", :controller => 'news', :action => 'index'
203 205 should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom'
204 206 should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml'
205 207 should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json'
206 208 should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567'
207 209 should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567'
208 210 should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567'
209 211 should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567'
210 212 should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2'
211 213 should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567'
212 214 should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234'
213 215 should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567'
214 216 should_route :get, "/news/preview", :controller => 'previews', :action => 'news'
215 217
216 218 should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567'
217 219 should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567'
218 220
219 221 should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567'
220 222
221 223 should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567'
222 224 should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15'
223 225 end
224 226
225 227 context "projects" do
226 228 should_route :get, "/projects", :controller => 'projects', :action => 'index'
227 229 should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom'
228 230 should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml'
229 231 should_route :get, "/projects/new", :controller => 'projects', :action => 'new'
230 232 should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test'
231 233 should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml'
232 234 should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223'
233 235 should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members'
234 236 should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33'
235 237 should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33'
236 238 should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33'
237 239 should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33'
238 240 should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom'
239 241
240 242 should_route :post, "/projects", :controller => 'projects', :action => 'create'
241 243 should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml'
242 244 should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33'
243 245 should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64'
244 246 should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64'
245 247
246 248 should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64'
247 249 should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223'
248 250 should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml'
249 251
250 252 should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64'
251 253 should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml'
252 254 should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64'
253 255 end
254 256
255 257 context "queries" do
256 258 should_route :get, "/queries.xml", :controller => 'queries', :action => 'index', :format => 'xml'
257 259 should_route :get, "/queries.json", :controller => 'queries', :action => 'index', :format => 'json'
258 260
259 261 should_route :get, "/queries/new", :controller => 'queries', :action => 'new'
260 262 should_route :get, "/projects/redmine/queries/new", :controller => 'queries', :action => 'new', :project_id => 'redmine'
261 263
262 264 should_route :post, "/queries", :controller => 'queries', :action => 'create'
263 265 should_route :post, "/projects/redmine/queries", :controller => 'queries', :action => 'create', :project_id => 'redmine'
264 266
265 267 should_route :get, "/queries/1/edit", :controller => 'queries', :action => 'edit', :id => '1'
266 268
267 269 should_route :put, "/queries/1", :controller => 'queries', :action => 'update', :id => '1'
268 270
269 271 should_route :delete, "/queries/1", :controller => 'queries', :action => 'destroy', :id => '1'
270 272 end
271 273
272 274 context "repositories" do
273 275 should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine'
274 276 should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
275 277 should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine'
276 278 should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom'
277 279 should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457'
278 280 should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457'
279 281 should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff'
280 282 should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c]
281 283 should_route :get, "/projects/redmine/repository/revisions/2/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c], :rev => '2'
282 284 should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c]
283 285 should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c]
284 286 should_route :get, "/projects/redmine/repository/revisions/2/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2'
285 287 should_route :get, "/projects/redmine/repository/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :format => 'raw'
286 288 should_route :get, "/projects/redmine/repository/revisions/2/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2', :format => 'raw'
287 289 should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c]
288 290 should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c]
289 291 should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine'
290 292
291 293 should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
292 294 end
293 295
294 296 context "roles" do
295 297 should_route :get, "/roles", :controller => 'roles', :action => 'index'
296 298 should_route :get, "/roles/new", :controller => 'roles', :action => 'new'
297 299 should_route :post, "/roles", :controller => 'roles', :action => 'create'
298 300 should_route :get, "/roles/2/edit", :controller => 'roles', :action => 'edit', :id => 2
299 301 should_route :put, "/roles/2", :controller => 'roles', :action => 'update', :id => 2
300 302 should_route :delete, "/roles/2", :controller => 'roles', :action => 'destroy', :id => 2
301 303 should_route :get, "/roles/permissions", :controller => 'roles', :action => 'permissions'
302 304 should_route :post, "/roles/permissions", :controller => 'roles', :action => 'permissions'
303 305 end
304 306
305 307 context "timelogs (global)" do
306 308 should_route :get, "/time_entries", :controller => 'timelog', :action => 'index'
307 309 should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv'
308 310 should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom'
309 311 should_route :get, "/time_entries/new", :controller => 'timelog', :action => 'new'
310 312 should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22'
311 313
312 314 should_route :post, "/time_entries", :controller => 'timelog', :action => 'create'
313 315
314 316 should_route :put, "/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22'
315 317
316 318 should_route :delete, "/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55'
317 319 end
318 320
319 321 context "timelogs (scoped under project)" do
320 322 should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567'
321 323 should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv'
322 324 should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom'
323 325 should_route :get, "/projects/567/time_entries/new", :controller => 'timelog', :action => 'new', :project_id => '567'
324 326 should_route :get, "/projects/567/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567'
325 327
326 328 should_route :post, "/projects/567/time_entries", :controller => 'timelog', :action => 'create', :project_id => '567'
327 329
328 330 should_route :put, "/projects/567/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567'
329 331
330 332 should_route :delete, "/projects/567/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567'
331 333 end
332 334
333 335 context "timelogs (scoped under issues)" do
334 336 should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234'
335 337 should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv'
336 338 should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom'
337 339 should_route :get, "/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234'
338 340 should_route :get, "/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234'
339 341
340 342 should_route :post, "/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234'
341 343
342 344 should_route :put, "/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234'
343 345
344 346 should_route :delete, "/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234'
345 347 end
346 348
347 349 context "timelogs (scoped under project and issues)" do
348 350 should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook'
349 351 should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv'
350 352 should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom'
351 353 should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook'
352 354 should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
353 355
354 356 should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook'
355 357
356 358 should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
357 359
358 360 should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook'
359 361
360 362 should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report'
361 363 should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567'
362 364 should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv'
363 365 end
364 366
365 367 context "users" do
366 368 should_route :get, "/users", :controller => 'users', :action => 'index'
367 369 should_route :get, "/users.xml", :controller => 'users', :action => 'index', :format => 'xml'
368 370 should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44'
369 371 should_route :get, "/users/44.xml", :controller => 'users', :action => 'show', :id => '44', :format => 'xml'
370 372 should_route :get, "/users/current", :controller => 'users', :action => 'show', :id => 'current'
371 373 should_route :get, "/users/current.xml", :controller => 'users', :action => 'show', :id => 'current', :format => 'xml'
372 374 should_route :get, "/users/new", :controller => 'users', :action => 'new'
373 375 should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
374 376
375 377 should_route :post, "/users", :controller => 'users', :action => 'create'
376 378 should_route :post, "/users.xml", :controller => 'users', :action => 'create', :format => 'xml'
377 379
378 380 should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444'
379 381 should_route :put, "/users/444.xml", :controller => 'users', :action => 'update', :id => '444', :format => 'xml'
380 382
381 383 should_route :delete, "/users/44", :controller => 'users', :action => 'destroy', :id => '44'
382 384 should_route :delete, "/users/44.xml", :controller => 'users', :action => 'destroy', :id => '44', :format => 'xml'
383 385
384 386 should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123'
385 387 should_route :put, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55'
386 388 should_route :delete, "/users/123/memberships/55", :controller => 'users', :action => 'destroy_membership', :id => '123', :membership_id => '55'
387 389 end
388 390
389 391 context "versions" do
390 392 # /projects/foo/versions is /projects/foo/roadmap
391 393 should_route :get, "/projects/foo/versions.xml", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'xml'
392 394 should_route :get, "/projects/foo/versions.json", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'json'
393 395
394 396 should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo'
395 397
396 398 should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo'
397 399 should_route :post, "/projects/foo/versions.xml", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'xml'
398 400 should_route :post, "/projects/foo/versions.json", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'json'
399 401
400 402 should_route :get, "/versions/1", :controller => 'versions', :action => 'show', :id => '1'
401 403 should_route :get, "/versions/1.xml", :controller => 'versions', :action => 'show', :id => '1', :format => 'xml'
402 404 should_route :get, "/versions/1.json", :controller => 'versions', :action => 'show', :id => '1', :format => 'json'
403 405
404 406 should_route :get, "/versions/1/edit", :controller => 'versions', :action => 'edit', :id => '1'
405 407
406 408 should_route :put, "/versions/1", :controller => 'versions', :action => 'update', :id => '1'
407 409 should_route :put, "/versions/1.xml", :controller => 'versions', :action => 'update', :id => '1', :format => 'xml'
408 410 should_route :put, "/versions/1.json", :controller => 'versions', :action => 'update', :id => '1', :format => 'json'
409 411
410 412 should_route :delete, "/versions/1", :controller => 'versions', :action => 'destroy', :id => '1'
411 413 should_route :delete, "/versions/1.xml", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'xml'
412 414 should_route :delete, "/versions/1.json", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'json'
413 415
414 416 should_route :put, "/projects/foo/versions/close_completed", :controller => 'versions', :action => 'close_completed', :project_id => 'foo'
415 417 should_route :post, "/versions/1/status_by", :controller => 'versions', :action => 'status_by', :id => '1'
416 418 end
417 419
418 420 context "welcome" do
419 421 should_route :get, "/robots.txt", :controller => 'welcome', :action => 'robots'
420 422 end
421 423
422 424 context "wiki (singular, project's pages)" do
423 425 should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567'
424 426 should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :id => 'lalala'
425 427 should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :id => 'my_page'
426 428 should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :id => 'CookBook_documentation'
427 429 should_route :get, "/projects/1/wiki/CookBook_documentation/diff", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation'
428 430 should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
429 431 should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2', :version_from => '1'
430 432 should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
431 433 should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
432 434 should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567'
433 435 should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567'
434 436 should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567'
435 437
436 438 should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation'
437 439 should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
438 440 should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida'
439 441 should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :id => 'ladida'
440 442
441 443 should_route :put, "/projects/567/wiki/my_page", :controller => 'wiki', :action => 'update', :project_id => '567', :id => 'my_page'
442 444
443 445 should_route :delete, "/projects/22/wiki/ladida", :controller => 'wiki', :action => 'destroy', :project_id => '22', :id => 'ladida'
444 446 end
445 447
446 448 context "wikis (plural, admin setup)" do
447 449 should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
448 450
449 451 should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida'
450 452 should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
451 453 end
452 454
453 455 context "administration panel" do
454 456 should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects'
455 457 end
456 458 end
General Comments 0
You need to be logged in to leave comments. Login now