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