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