@@ -0,0 +1,109 | |||
|
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 RoutingWikiTest < ActionController::IntegrationTest | |
|
21 | def test_wiki_singular_projects_pages | |
|
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/my_page/edit" }, | |
|
33 | { :controller => 'wiki', :action => 'edit', :project_id => '567', | |
|
34 | :id => 'my_page' } | |
|
35 | ) | |
|
36 | assert_routing( | |
|
37 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" }, | |
|
38 | { :controller => 'wiki', :action => 'history', :project_id => '1', | |
|
39 | :id => 'CookBook_documentation' } | |
|
40 | ) | |
|
41 | assert_routing( | |
|
42 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" }, | |
|
43 | { :controller => 'wiki', :action => 'diff', :project_id => '1', | |
|
44 | :id => 'CookBook_documentation' } | |
|
45 | ) | |
|
46 | assert_routing( | |
|
47 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" }, | |
|
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/diff/2/vs/1" }, | |
|
53 | { :controller => 'wiki', :action => 'diff', :project_id => '1', | |
|
54 | :id => 'CookBook_documentation', :version => '2', :version_from => '1' } | |
|
55 | ) | |
|
56 | assert_routing( | |
|
57 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" }, | |
|
58 | { :controller => 'wiki', :action => 'annotate', :project_id => '1', | |
|
59 | :id => 'CookBook_documentation', :version => '2' } | |
|
60 | ) | |
|
61 | assert_routing( | |
|
62 | { :method => 'get', :path => "/projects/22/wiki/ladida/rename" }, | |
|
63 | { :controller => 'wiki', :action => 'rename', :project_id => '22', | |
|
64 | :id => 'ladida' } | |
|
65 | ) | |
|
66 | assert_routing( | |
|
67 | { :method => 'get', :path => "/projects/567/wiki/index" }, | |
|
68 | { :controller => 'wiki', :action => 'index', :project_id => '567' } | |
|
69 | ) | |
|
70 | assert_routing( | |
|
71 | { :method => 'get', :path => "/projects/567/wiki/date_index" }, | |
|
72 | { :controller => 'wiki', :action => 'date_index', :project_id => '567' } | |
|
73 | ) | |
|
74 | assert_routing( | |
|
75 | { :method => 'get', :path => "/projects/567/wiki/export" }, | |
|
76 | { :controller => 'wiki', :action => 'export', :project_id => '567' } | |
|
77 | ) | |
|
78 | assert_routing( | |
|
79 | { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" }, | |
|
80 | { :controller => 'wiki', :action => 'preview', :project_id => '567', | |
|
81 | :id => 'CookBook_documentation' } | |
|
82 | ) | |
|
83 | assert_routing( | |
|
84 | { :method => 'post', :path => "/projects/22/wiki/ladida/rename" }, | |
|
85 | { :controller => 'wiki', :action => 'rename', :project_id => '22', | |
|
86 | :id => 'ladida' } | |
|
87 | ) | |
|
88 | assert_routing( | |
|
89 | { :method => 'post', :path => "/projects/22/wiki/ladida/protect" }, | |
|
90 | { :controller => 'wiki', :action => 'protect', :project_id => '22', | |
|
91 | :id => 'ladida' } | |
|
92 | ) | |
|
93 | assert_routing( | |
|
94 | { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" }, | |
|
95 | { :controller => 'wiki', :action => 'add_attachment', :project_id => '22', | |
|
96 | :id => 'ladida' } | |
|
97 | ) | |
|
98 | assert_routing( | |
|
99 | { :method => 'put', :path => "/projects/567/wiki/my_page" }, | |
|
100 | { :controller => 'wiki', :action => 'update', :project_id => '567', | |
|
101 | :id => 'my_page' } | |
|
102 | ) | |
|
103 | assert_routing( | |
|
104 | { :method => 'delete', :path => "/projects/22/wiki/ladida" }, | |
|
105 | { :controller => 'wiki', :action => 'destroy', :project_id => '22', | |
|
106 | :id => 'ladida' } | |
|
107 | ) | |
|
108 | end | |
|
109 | end |
@@ -1,124 +1,35 | |||
|
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_wiki_singular_projects_pages | |
|
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/my_page/edit" }, | |
|
33 | { :controller => 'wiki', :action => 'edit', :project_id => '567', | |
|
34 | :id => 'my_page' } | |
|
35 | ) | |
|
36 | assert_routing( | |
|
37 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" }, | |
|
38 | { :controller => 'wiki', :action => 'history', :project_id => '1', | |
|
39 | :id => 'CookBook_documentation' } | |
|
40 | ) | |
|
41 | assert_routing( | |
|
42 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" }, | |
|
43 | { :controller => 'wiki', :action => 'diff', :project_id => '1', | |
|
44 | :id => 'CookBook_documentation' } | |
|
45 | ) | |
|
46 | assert_routing( | |
|
47 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" }, | |
|
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/diff/2/vs/1" }, | |
|
53 | { :controller => 'wiki', :action => 'diff', :project_id => '1', | |
|
54 | :id => 'CookBook_documentation', :version => '2', :version_from => '1' } | |
|
55 | ) | |
|
56 | assert_routing( | |
|
57 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" }, | |
|
58 | { :controller => 'wiki', :action => 'annotate', :project_id => '1', | |
|
59 | :id => 'CookBook_documentation', :version => '2' } | |
|
60 | ) | |
|
61 | assert_routing( | |
|
62 | { :method => 'get', :path => "/projects/22/wiki/ladida/rename" }, | |
|
63 | { :controller => 'wiki', :action => 'rename', :project_id => '22', | |
|
64 | :id => 'ladida' } | |
|
65 | ) | |
|
66 | assert_routing( | |
|
67 | { :method => 'get', :path => "/projects/567/wiki/index" }, | |
|
68 | { :controller => 'wiki', :action => 'index', :project_id => '567' } | |
|
69 | ) | |
|
70 | assert_routing( | |
|
71 | { :method => 'get', :path => "/projects/567/wiki/date_index" }, | |
|
72 | { :controller => 'wiki', :action => 'date_index', :project_id => '567' } | |
|
73 | ) | |
|
74 | assert_routing( | |
|
75 | { :method => 'get', :path => "/projects/567/wiki/export" }, | |
|
76 | { :controller => 'wiki', :action => 'export', :project_id => '567' } | |
|
77 | ) | |
|
78 | assert_routing( | |
|
79 | { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" }, | |
|
80 | { :controller => 'wiki', :action => 'preview', :project_id => '567', | |
|
81 | :id => 'CookBook_documentation' } | |
|
82 | ) | |
|
83 | assert_routing( | |
|
84 | { :method => 'post', :path => "/projects/22/wiki/ladida/rename" }, | |
|
85 | { :controller => 'wiki', :action => 'rename', :project_id => '22', | |
|
86 | :id => 'ladida' } | |
|
87 | ) | |
|
88 | assert_routing( | |
|
89 | { :method => 'post', :path => "/projects/22/wiki/ladida/protect" }, | |
|
90 | { :controller => 'wiki', :action => 'protect', :project_id => '22', | |
|
91 | :id => 'ladida' } | |
|
92 | ) | |
|
93 | assert_routing( | |
|
94 | { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" }, | |
|
95 | { :controller => 'wiki', :action => 'add_attachment', :project_id => '22', | |
|
96 | :id => 'ladida' } | |
|
97 | ) | |
|
98 | assert_routing( | |
|
99 | { :method => 'put', :path => "/projects/567/wiki/my_page" }, | |
|
100 | { :controller => 'wiki', :action => 'update', :project_id => '567', | |
|
101 | :id => 'my_page' } | |
|
102 | ) | |
|
103 | assert_routing( | |
|
104 | { :method => 'delete', :path => "/projects/22/wiki/ladida" }, | |
|
105 | { :controller => 'wiki', :action => 'destroy', :project_id => '22', | |
|
106 | :id => 'ladida' } | |
|
107 | ) | |
|
108 | end | |
|
109 | ||
|
110 | 21 | def test_wikis_plural_admin_setup |
|
111 | 22 | assert_routing( |
|
112 | 23 | { :method => 'get', :path => "/projects/ladida/wiki/destroy" }, |
|
113 | 24 | { :controller => 'wikis', :action => 'destroy', :id => 'ladida' } |
|
114 | 25 | ) |
|
115 | 26 | assert_routing( |
|
116 | 27 | { :method => 'post', :path => "/projects/ladida/wiki" }, |
|
117 | 28 | { :controller => 'wikis', :action => 'edit', :id => 'ladida' } |
|
118 | 29 | ) |
|
119 | 30 | assert_routing( |
|
120 | 31 | { :method => 'post', :path => "/projects/ladida/wiki/destroy" }, |
|
121 | 32 | { :controller => 'wikis', :action => 'destroy', :id => 'ladida' } |
|
122 | 33 | ) |
|
123 | 34 | end |
|
124 | 35 | end |
General Comments 0
You need to be logged in to leave comments.
Login now