##// END OF EJS Templates
test: route: move queries test to new file...
Toshi MARUYAMA -
r8241:720e97c2f80b
parent child
Show More
@@ -0,0 +1,59
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 RoutingQueriesTest < ActionController::IntegrationTest
21 def test_queries
22 assert_routing(
23 { :method => 'get', :path => "/queries.xml" },
24 { :controller => 'queries', :action => 'index', :format => 'xml' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/queries.json" },
28 { :controller => 'queries', :action => 'index', :format => 'json' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/queries/new" },
32 { :controller => 'queries', :action => 'new' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/projects/redmine/queries/new" },
36 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
37 )
38 assert_routing(
39 { :method => 'post', :path => "/queries" },
40 { :controller => 'queries', :action => 'create' }
41 )
42 assert_routing(
43 { :method => 'post', :path => "/projects/redmine/queries" },
44 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
45 )
46 assert_routing(
47 { :method => 'get', :path => "/queries/1/edit" },
48 { :controller => 'queries', :action => 'edit', :id => '1' }
49 )
50 assert_routing(
51 { :method => 'put', :path => "/queries/1" },
52 { :controller => 'queries', :action => 'update', :id => '1' }
53 )
54 assert_routing(
55 { :method => 'delete', :path => "/queries/1" },
56 { :controller => 'queries', :action => 'destroy', :id => '1' }
57 )
58 end
59 end
@@ -1,163 +1,124
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 def test_queries
22 assert_routing(
23 { :method => 'get', :path => "/queries.xml" },
24 { :controller => 'queries', :action => 'index', :format => 'xml' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/queries.json" },
28 { :controller => 'queries', :action => 'index', :format => 'json' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/queries/new" },
32 { :controller => 'queries', :action => 'new' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/projects/redmine/queries/new" },
36 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
37 )
38 assert_routing(
39 { :method => 'post', :path => "/queries" },
40 { :controller => 'queries', :action => 'create' }
41 )
42 assert_routing(
43 { :method => 'post', :path => "/projects/redmine/queries" },
44 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
45 )
46 assert_routing(
47 { :method => 'get', :path => "/queries/1/edit" },
48 { :controller => 'queries', :action => 'edit', :id => '1' }
49 )
50 assert_routing(
51 { :method => 'put', :path => "/queries/1" },
52 { :controller => 'queries', :action => 'update', :id => '1' }
53 )
54 assert_routing(
55 { :method => 'delete', :path => "/queries/1" },
56 { :controller => 'queries', :action => 'destroy', :id => '1' }
57 )
58 end
59
60 21 def test_wiki_singular_projects_pages
61 22 assert_routing(
62 23 { :method => 'get', :path => "/projects/567/wiki" },
63 24 { :controller => 'wiki', :action => 'show', :project_id => '567' }
64 25 )
65 26 assert_routing(
66 27 { :method => 'get', :path => "/projects/567/wiki/lalala" },
67 28 { :controller => 'wiki', :action => 'show', :project_id => '567',
68 29 :id => 'lalala' }
69 30 )
70 31 assert_routing(
71 32 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
72 33 { :controller => 'wiki', :action => 'edit', :project_id => '567',
73 34 :id => 'my_page' }
74 35 )
75 36 assert_routing(
76 37 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
77 38 { :controller => 'wiki', :action => 'history', :project_id => '1',
78 39 :id => 'CookBook_documentation' }
79 40 )
80 41 assert_routing(
81 42 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
82 43 { :controller => 'wiki', :action => 'diff', :project_id => '1',
83 44 :id => 'CookBook_documentation' }
84 45 )
85 46 assert_routing(
86 47 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
87 48 { :controller => 'wiki', :action => 'diff', :project_id => '1',
88 49 :id => 'CookBook_documentation', :version => '2' }
89 50 )
90 51 assert_routing(
91 52 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
92 53 { :controller => 'wiki', :action => 'diff', :project_id => '1',
93 54 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
94 55 )
95 56 assert_routing(
96 57 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
97 58 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
98 59 :id => 'CookBook_documentation', :version => '2' }
99 60 )
100 61 assert_routing(
101 62 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
102 63 { :controller => 'wiki', :action => 'rename', :project_id => '22',
103 64 :id => 'ladida' }
104 65 )
105 66 assert_routing(
106 67 { :method => 'get', :path => "/projects/567/wiki/index" },
107 68 { :controller => 'wiki', :action => 'index', :project_id => '567' }
108 69 )
109 70 assert_routing(
110 71 { :method => 'get', :path => "/projects/567/wiki/date_index" },
111 72 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
112 73 )
113 74 assert_routing(
114 75 { :method => 'get', :path => "/projects/567/wiki/export" },
115 76 { :controller => 'wiki', :action => 'export', :project_id => '567' }
116 77 )
117 78 assert_routing(
118 79 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
119 80 { :controller => 'wiki', :action => 'preview', :project_id => '567',
120 81 :id => 'CookBook_documentation' }
121 82 )
122 83 assert_routing(
123 84 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
124 85 { :controller => 'wiki', :action => 'rename', :project_id => '22',
125 86 :id => 'ladida' }
126 87 )
127 88 assert_routing(
128 89 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
129 90 { :controller => 'wiki', :action => 'protect', :project_id => '22',
130 91 :id => 'ladida' }
131 92 )
132 93 assert_routing(
133 94 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
134 95 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
135 96 :id => 'ladida' }
136 97 )
137 98 assert_routing(
138 99 { :method => 'put', :path => "/projects/567/wiki/my_page" },
139 100 { :controller => 'wiki', :action => 'update', :project_id => '567',
140 101 :id => 'my_page' }
141 102 )
142 103 assert_routing(
143 104 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
144 105 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
145 106 :id => 'ladida' }
146 107 )
147 108 end
148 109
149 110 def test_wikis_plural_admin_setup
150 111 assert_routing(
151 112 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
152 113 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
153 114 )
154 115 assert_routing(
155 116 { :method => 'post', :path => "/projects/ladida/wiki" },
156 117 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
157 118 )
158 119 assert_routing(
159 120 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
160 121 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
161 122 )
162 123 end
163 124 end
General Comments 0
You need to be logged in to leave comments. Login now