@@ -1,136 +1,134 | |||||
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 RoutingIssuesTest < ActionController::IntegrationTest |
|
20 | class RoutingIssuesTest < ActionController::IntegrationTest | |
21 | def test_issues_rest_actions |
|
21 | def test_issues_rest_actions | |
22 | assert_routing( |
|
22 | assert_routing( | |
23 | { :method => 'get', :path => "/issues" }, |
|
23 | { :method => 'get', :path => "/issues" }, | |
24 | { :controller => 'issues', :action => 'index' } |
|
24 | { :controller => 'issues', :action => 'index' } | |
25 | ) |
|
25 | ) | |
26 | assert_routing( |
|
26 | assert_routing( | |
27 | { :method => 'get', :path => "/issues.pdf" }, |
|
27 | { :method => 'get', :path => "/issues.pdf" }, | |
28 | { :controller => 'issues', :action => 'index', :format => 'pdf' } |
|
28 | { :controller => 'issues', :action => 'index', :format => 'pdf' } | |
29 | ) |
|
29 | ) | |
30 | assert_routing( |
|
30 | assert_routing( | |
31 | { :method => 'get', :path => "/issues.atom" }, |
|
31 | { :method => 'get', :path => "/issues.atom" }, | |
32 | { :controller => 'issues', :action => 'index', :format => 'atom' } |
|
32 | { :controller => 'issues', :action => 'index', :format => 'atom' } | |
33 | ) |
|
33 | ) | |
34 | assert_routing( |
|
34 | assert_routing( | |
35 | { :method => 'get', :path => "/issues.xml" }, |
|
35 | { :method => 'get', :path => "/issues.xml" }, | |
36 | { :controller => 'issues', :action => 'index', :format => 'xml' } |
|
36 | { :controller => 'issues', :action => 'index', :format => 'xml' } | |
37 | ) |
|
37 | ) | |
38 | assert_routing( |
|
38 | assert_routing( | |
39 | { :method => 'get', :path => "/issues/64" }, |
|
39 | { :method => 'get', :path => "/issues/64" }, | |
40 | { :controller => 'issues', :action => 'show', :id => '64' } |
|
40 | { :controller => 'issues', :action => 'show', :id => '64' } | |
41 | ) |
|
41 | ) | |
42 | assert_routing( |
|
42 | assert_routing( | |
43 | { :method => 'get', :path => "/issues/64.pdf" }, |
|
43 | { :method => 'get', :path => "/issues/64.pdf" }, | |
44 | { :controller => 'issues', :action => 'show', :id => '64', |
|
44 | { :controller => 'issues', :action => 'show', :id => '64', | |
45 | :format => 'pdf' } |
|
45 | :format => 'pdf' } | |
46 | ) |
|
46 | ) | |
47 | assert_routing( |
|
47 | assert_routing( | |
48 | { :method => 'get', :path => "/issues/64.atom" }, |
|
48 | { :method => 'get', :path => "/issues/64.atom" }, | |
49 | { :controller => 'issues', :action => 'show', :id => '64', |
|
49 | { :controller => 'issues', :action => 'show', :id => '64', | |
50 | :format => 'atom' } |
|
50 | :format => 'atom' } | |
51 | ) |
|
51 | ) | |
52 | assert_routing( |
|
52 | assert_routing( | |
53 | { :method => 'get', :path => "/issues/64.xml" }, |
|
53 | { :method => 'get', :path => "/issues/64.xml" }, | |
54 | { :controller => 'issues', :action => 'show', :id => '64', |
|
54 | { :controller => 'issues', :action => 'show', :id => '64', | |
55 | :format => 'xml' } |
|
55 | :format => 'xml' } | |
56 | ) |
|
56 | ) | |
57 | assert_routing( |
|
57 | assert_routing( | |
58 | { :method => 'post', :path => "/issues.xml" }, |
|
58 | { :method => 'post', :path => "/issues.xml" }, | |
59 | { :controller => 'issues', :action => 'create', :format => 'xml' } |
|
59 | { :controller => 'issues', :action => 'create', :format => 'xml' } | |
60 | ) |
|
60 | ) | |
61 | assert_routing( |
|
61 | assert_routing( | |
62 | { :method => 'get', :path => "/issues/64/edit" }, |
|
62 | { :method => 'get', :path => "/issues/64/edit" }, | |
63 | { :controller => 'issues', :action => 'edit', :id => '64' } |
|
63 | { :controller => 'issues', :action => 'edit', :id => '64' } | |
64 | ) |
|
64 | ) | |
65 | assert_routing( |
|
65 | assert_routing( | |
66 | { :method => 'put', :path => "/issues/1.xml" }, |
|
66 | { :method => 'put', :path => "/issues/1.xml" }, | |
67 | { :controller => 'issues', :action => 'update', :id => '1', |
|
67 | { :controller => 'issues', :action => 'update', :id => '1', | |
68 | :format => 'xml' } |
|
68 | :format => 'xml' } | |
69 | ) |
|
69 | ) | |
70 | assert_routing( |
|
70 | assert_routing( | |
71 | { :method => 'delete', :path => "/issues/1.xml" }, |
|
71 | { :method => 'delete', :path => "/issues/1.xml" }, | |
72 | { :controller => 'issues', :action => 'destroy', :id => '1', |
|
72 | { :controller => 'issues', :action => 'destroy', :id => '1', | |
73 | :format => 'xml' } |
|
73 | :format => 'xml' } | |
74 | ) |
|
74 | ) | |
75 | end |
|
75 | end | |
76 |
|
76 | |||
77 | def test_issues_rest_actions_scoped_under_project |
|
77 | def test_issues_rest_actions_scoped_under_project | |
78 | assert_routing( |
|
78 | assert_routing( | |
79 | { :method => 'get', :path => "/projects/23/issues" }, |
|
79 | { :method => 'get', :path => "/projects/23/issues" }, | |
80 | { :controller => 'issues', :action => 'index', :project_id => '23' } |
|
80 | { :controller => 'issues', :action => 'index', :project_id => '23' } | |
81 | ) |
|
81 | ) | |
82 | assert_routing( |
|
82 | assert_routing( | |
83 | { :method => 'get', :path => "/projects/23/issues.pdf" }, |
|
83 | { :method => 'get', :path => "/projects/23/issues.pdf" }, | |
84 | { :controller => 'issues', :action => 'index', :project_id => '23', |
|
84 | { :controller => 'issues', :action => 'index', :project_id => '23', | |
85 | :format => 'pdf' } |
|
85 | :format => 'pdf' } | |
86 | ) |
|
86 | ) | |
87 | assert_routing( |
|
87 | assert_routing( | |
88 | { :method => 'get', :path => "/projects/23/issues.atom" }, |
|
88 | { :method => 'get', :path => "/projects/23/issues.atom" }, | |
89 | { :controller => 'issues', :action => 'index', :project_id => '23', |
|
89 | { :controller => 'issues', :action => 'index', :project_id => '23', | |
90 | :format => 'atom' } |
|
90 | :format => 'atom' } | |
91 | ) |
|
91 | ) | |
92 | assert_routing( |
|
92 | assert_routing( | |
93 | { :method => 'get', :path => "/projects/23/issues.xml" }, |
|
93 | { :method => 'get', :path => "/projects/23/issues.xml" }, | |
94 | { :controller => 'issues', :action => 'index', :project_id => '23', |
|
94 | { :controller => 'issues', :action => 'index', :project_id => '23', | |
95 | :format => 'xml' } |
|
95 | :format => 'xml' } | |
96 | ) |
|
96 | ) | |
97 | assert_routing( |
|
97 | assert_routing( | |
98 | { :method => 'post', :path => "/projects/23/issues" }, |
|
98 | { :method => 'post', :path => "/projects/23/issues" }, | |
99 | { :controller => 'issues', :action => 'create', :project_id => '23' } |
|
99 | { :controller => 'issues', :action => 'create', :project_id => '23' } | |
100 | ) |
|
100 | ) | |
101 | assert_routing( |
|
101 | assert_routing( | |
102 | { :method => 'get', :path => "/projects/23/issues/new" }, |
|
102 | { :method => 'get', :path => "/projects/23/issues/new" }, | |
103 | { :controller => 'issues', :action => 'new', :project_id => '23' } |
|
103 | { :controller => 'issues', :action => 'new', :project_id => '23' } | |
104 | ) |
|
104 | ) | |
105 | end |
|
105 | end | |
106 |
|
106 | |||
107 | def test_issues_form_update |
|
107 | def test_issues_form_update | |
108 | ["post", "put"].each do |method| |
|
108 | ["post", "put"].each do |method| | |
109 | assert_routing( |
|
109 | assert_routing( | |
110 | { :method => method, :path => "/projects/23/issues/new" }, |
|
110 | { :method => method, :path => "/projects/23/issues/new" }, | |
111 | { :controller => 'issues', :action => 'new', :project_id => '23' } |
|
111 | { :controller => 'issues', :action => 'new', :project_id => '23' } | |
112 | ) |
|
112 | ) | |
113 | end |
|
113 | end | |
114 | end |
|
114 | end | |
115 |
|
115 | |||
116 | def test_issues_extra_actions |
|
116 | def test_issues_extra_actions | |
117 | assert_routing( |
|
117 | assert_routing( | |
118 | { :method => 'get', :path => "/projects/23/issues/64/copy" }, |
|
118 | { :method => 'get', :path => "/projects/23/issues/64/copy" }, | |
119 | { :controller => 'issues', :action => 'new', :project_id => '23', |
|
119 | { :controller => 'issues', :action => 'new', :project_id => '23', | |
120 | :copy_from => '64' } |
|
120 | :copy_from => '64' } | |
121 | ) |
|
121 | ) | |
122 | assert_routing( |
|
|||
123 | { :method => 'get', :path => "/issues/bulk_edit" }, |
|
|||
124 | { :controller => 'issues', :action => 'bulk_edit' } |
|
|||
125 | ) |
|
|||
126 | # For updating the bulk edit form |
|
122 | # For updating the bulk edit form | |
127 | assert_routing( |
|
123 | ["get", "post"].each do |method| | |
128 | { :method => 'post', :path => "/issues/bulk_edit" }, |
|
124 | assert_routing( | |
129 | { :controller => 'issues', :action => 'bulk_edit' } |
|
125 | { :method => method, :path => "/issues/bulk_edit" }, | |
130 | ) |
|
126 | { :controller => 'issues', :action => 'bulk_edit' } | |
|
127 | ) | |||
|
128 | end | |||
131 | assert_routing( |
|
129 | assert_routing( | |
132 | { :method => 'post', :path => "/issues/bulk_update" }, |
|
130 | { :method => 'post', :path => "/issues/bulk_update" }, | |
133 | { :controller => 'issues', :action => 'bulk_update' } |
|
131 | { :controller => 'issues', :action => 'bulk_update' } | |
134 | ) |
|
132 | ) | |
135 | end |
|
133 | end | |
136 | end |
|
134 | end |
General Comments 0
You need to be logged in to leave comments.
Login now