comparison .svn/pristine/19/19c2933293d5536cb86e9ab59b2a501d3507d1a0.svn-base @ 1295:622f24f53b42 redmine-2.3

Update to Redmine SVN revision 11972 on 2.3-stable branch
author Chris Cannam
date Fri, 14 Jun 2013 09:02:21 +0100
parents
children
comparison
equal deleted inserted replaced
1294:3e4c3460b6ca 1295:622f24f53b42
1 # Redmine - project management software
2 # Copyright (C) 2006-2012 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 RoutingWikiTest < ActionController::IntegrationTest
21 def test_wiki_matching
22 assert_routing(
23 { :method => 'get', :path => "/projects/567/wiki" },
24 { :controller => 'wiki', :action => 'show', :project_id => '567' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/projects/567/wiki/lalala" },
28 { :controller => 'wiki', :action => 'show', :project_id => '567',
29 :id => 'lalala' }
30 )
31 assert_routing(
32 { :method => 'get', :path => "/projects/567/wiki/lalala.pdf" },
33 { :controller => 'wiki', :action => 'show', :project_id => '567',
34 :id => 'lalala', :format => 'pdf' }
35 )
36 assert_routing(
37 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
38 { :controller => 'wiki', :action => 'diff', :project_id => '1',
39 :id => 'CookBook_documentation' }
40 )
41 assert_routing(
42 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2" },
43 { :controller => 'wiki', :action => 'show', :project_id => '1',
44 :id => 'CookBook_documentation', :version => '2' }
45 )
46 assert_routing(
47 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2/diff" },
48 { :controller => 'wiki', :action => 'diff', :project_id => '1',
49 :id => 'CookBook_documentation', :version => '2' }
50 )
51 assert_routing(
52 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2/annotate" },
53 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
54 :id => 'CookBook_documentation', :version => '2' }
55 )
56 end
57
58 def test_wiki_misc
59 assert_routing(
60 { :method => 'get', :path => "/projects/567/wiki/date_index" },
61 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
62 )
63 assert_routing(
64 { :method => 'get', :path => "/projects/567/wiki/export" },
65 { :controller => 'wiki', :action => 'export', :project_id => '567' }
66 )
67 assert_routing(
68 { :method => 'get', :path => "/projects/567/wiki/export.pdf" },
69 { :controller => 'wiki', :action => 'export', :project_id => '567', :format => 'pdf' }
70 )
71 assert_routing(
72 { :method => 'get', :path => "/projects/567/wiki/index" },
73 { :controller => 'wiki', :action => 'index', :project_id => '567' }
74 )
75 end
76
77 def test_wiki_resources
78 assert_routing(
79 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
80 { :controller => 'wiki', :action => 'edit', :project_id => '567',
81 :id => 'my_page' }
82 )
83 assert_routing(
84 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
85 { :controller => 'wiki', :action => 'history', :project_id => '1',
86 :id => 'CookBook_documentation' }
87 )
88 assert_routing(
89 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
90 { :controller => 'wiki', :action => 'rename', :project_id => '22',
91 :id => 'ladida' }
92 )
93 ["post", "put"].each do |method|
94 assert_routing(
95 { :method => method, :path => "/projects/567/wiki/CookBook_documentation/preview" },
96 { :controller => 'wiki', :action => 'preview', :project_id => '567',
97 :id => 'CookBook_documentation' }
98 )
99 end
100 assert_routing(
101 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
102 { :controller => 'wiki', :action => 'rename', :project_id => '22',
103 :id => 'ladida' }
104 )
105 assert_routing(
106 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
107 { :controller => 'wiki', :action => 'protect', :project_id => '22',
108 :id => 'ladida' }
109 )
110 assert_routing(
111 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
112 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
113 :id => 'ladida' }
114 )
115 assert_routing(
116 { :method => 'put', :path => "/projects/567/wiki/my_page" },
117 { :controller => 'wiki', :action => 'update', :project_id => '567',
118 :id => 'my_page' }
119 )
120 assert_routing(
121 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
122 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
123 :id => 'ladida' }
124 )
125 assert_routing(
126 { :method => 'delete', :path => "/projects/22/wiki/ladida/3" },
127 { :controller => 'wiki', :action => 'destroy_version', :project_id => '22',
128 :id => 'ladida', :version => '3' }
129 )
130 end
131
132 def test_api
133 assert_routing(
134 { :method => 'get', :path => "/projects/567/wiki/my_page.xml" },
135 { :controller => 'wiki', :action => 'show', :project_id => '567',
136 :id => 'my_page', :format => 'xml' }
137 )
138 assert_routing(
139 { :method => 'get', :path => "/projects/567/wiki/my_page.json" },
140 { :controller => 'wiki', :action => 'show', :project_id => '567',
141 :id => 'my_page', :format => 'json' }
142 )
143 assert_routing(
144 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2.xml" },
145 { :controller => 'wiki', :action => 'show', :project_id => '1',
146 :id => 'CookBook_documentation', :version => '2', :format => 'xml' }
147 )
148 assert_routing(
149 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2.json" },
150 { :controller => 'wiki', :action => 'show', :project_id => '1',
151 :id => 'CookBook_documentation', :version => '2', :format => 'json' }
152 )
153 assert_routing(
154 { :method => 'get', :path => "/projects/567/wiki/index.xml" },
155 { :controller => 'wiki', :action => 'index', :project_id => '567', :format => 'xml' }
156 )
157 assert_routing(
158 { :method => 'get', :path => "/projects/567/wiki/index.json" },
159 { :controller => 'wiki', :action => 'index', :project_id => '567', :format => 'json' }
160 )
161 assert_routing(
162 { :method => 'put', :path => "/projects/567/wiki/my_page.xml" },
163 { :controller => 'wiki', :action => 'update', :project_id => '567',
164 :id => 'my_page', :format => 'xml' }
165 )
166 assert_routing(
167 { :method => 'put', :path => "/projects/567/wiki/my_page.json" },
168 { :controller => 'wiki', :action => 'update', :project_id => '567',
169 :id => 'my_page', :format => 'json' }
170 )
171 assert_routing(
172 { :method => 'delete', :path => "/projects/567/wiki/my_page.xml" },
173 { :controller => 'wiki', :action => 'destroy', :project_id => '567',
174 :id => 'my_page', :format => 'xml' }
175 )
176 assert_routing(
177 { :method => 'delete', :path => "/projects/567/wiki/my_page.json" },
178 { :controller => 'wiki', :action => 'destroy', :project_id => '567',
179 :id => 'my_page', :format => 'json' }
180 )
181 end
182 end