@@ -1,116 +1,119 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
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 |
|
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. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.expand_path('../../../test_helper', __FILE__) |
|
18 | require File.expand_path('../../../test_helper', __FILE__) | |
19 |
|
19 | |||
20 | class RoutingVersionsTest < ActionController::IntegrationTest |
|
20 | class RoutingVersionsTest < ActionController::IntegrationTest | |
21 | def test_versions_scoped_under_project |
|
21 | def test_roadmap | |
22 | # /projects/foo/versions is /projects/foo/roadmap |
|
22 | # /projects/foo/versions is /projects/foo/roadmap | |
23 | assert_routing( |
|
23 | assert_routing( | |
24 | { :method => 'get', :path => "/projects/33/roadmap" }, |
|
24 | { :method => 'get', :path => "/projects/33/roadmap" }, | |
25 | { :controller => 'versions', :action => 'index', :project_id => '33' } |
|
25 | { :controller => 'versions', :action => 'index', :project_id => '33' } | |
26 | ) |
|
26 | ) | |
|
27 | end | |||
|
28 | ||||
|
29 | def test_versions_scoped_under_project | |||
27 | assert_routing( |
|
30 | assert_routing( | |
28 | { :method => 'put', :path => "/projects/foo/versions/close_completed" }, |
|
31 | { :method => 'put', :path => "/projects/foo/versions/close_completed" }, | |
29 | { :controller => 'versions', :action => 'close_completed', |
|
32 | { :controller => 'versions', :action => 'close_completed', | |
30 | :project_id => 'foo' } |
|
33 | :project_id => 'foo' } | |
31 | ) |
|
34 | ) | |
32 | assert_routing( |
|
35 | assert_routing( | |
33 | { :method => 'get', :path => "/projects/foo/versions.xml" }, |
|
36 | { :method => 'get', :path => "/projects/foo/versions.xml" }, | |
34 | { :controller => 'versions', :action => 'index', |
|
37 | { :controller => 'versions', :action => 'index', | |
35 | :project_id => 'foo', :format => 'xml' } |
|
38 | :project_id => 'foo', :format => 'xml' } | |
36 | ) |
|
39 | ) | |
37 | assert_routing( |
|
40 | assert_routing( | |
38 | { :method => 'get', :path => "/projects/foo/versions.json" }, |
|
41 | { :method => 'get', :path => "/projects/foo/versions.json" }, | |
39 | { :controller => 'versions', :action => 'index', |
|
42 | { :controller => 'versions', :action => 'index', | |
40 | :project_id => 'foo', :format => 'json' } |
|
43 | :project_id => 'foo', :format => 'json' } | |
41 | ) |
|
44 | ) | |
42 | assert_routing( |
|
45 | assert_routing( | |
43 | { :method => 'get', :path => "/projects/foo/versions/new" }, |
|
46 | { :method => 'get', :path => "/projects/foo/versions/new" }, | |
44 | { :controller => 'versions', :action => 'new', |
|
47 | { :controller => 'versions', :action => 'new', | |
45 | :project_id => 'foo' } |
|
48 | :project_id => 'foo' } | |
46 | ) |
|
49 | ) | |
47 | assert_routing( |
|
50 | assert_routing( | |
48 | { :method => 'post', :path => "/projects/foo/versions" }, |
|
51 | { :method => 'post', :path => "/projects/foo/versions" }, | |
49 | { :controller => 'versions', :action => 'create', |
|
52 | { :controller => 'versions', :action => 'create', | |
50 | :project_id => 'foo' } |
|
53 | :project_id => 'foo' } | |
51 | ) |
|
54 | ) | |
52 | assert_routing( |
|
55 | assert_routing( | |
53 | { :method => 'post', :path => "/projects/foo/versions.xml" }, |
|
56 | { :method => 'post', :path => "/projects/foo/versions.xml" }, | |
54 | { :controller => 'versions', :action => 'create', |
|
57 | { :controller => 'versions', :action => 'create', | |
55 | :project_id => 'foo', :format => 'xml' } |
|
58 | :project_id => 'foo', :format => 'xml' } | |
56 | ) |
|
59 | ) | |
57 | assert_routing( |
|
60 | assert_routing( | |
58 | { :method => 'post', :path => "/projects/foo/versions.json" }, |
|
61 | { :method => 'post', :path => "/projects/foo/versions.json" }, | |
59 | { :controller => 'versions', :action => 'create', |
|
62 | { :controller => 'versions', :action => 'create', | |
60 | :project_id => 'foo', :format => 'json' } |
|
63 | :project_id => 'foo', :format => 'json' } | |
61 | ) |
|
64 | ) | |
62 | end |
|
65 | end | |
63 |
|
66 | |||
64 | def test_versions |
|
67 | def test_versions | |
65 | assert_routing( |
|
68 | assert_routing( | |
66 | { :method => 'get', :path => "/versions/1" }, |
|
69 | { :method => 'get', :path => "/versions/1" }, | |
67 | { :controller => 'versions', :action => 'show', :id => '1' } |
|
70 | { :controller => 'versions', :action => 'show', :id => '1' } | |
68 | ) |
|
71 | ) | |
69 | assert_routing( |
|
72 | assert_routing( | |
70 | { :method => 'get', :path => "/versions/1.xml" }, |
|
73 | { :method => 'get', :path => "/versions/1.xml" }, | |
71 | { :controller => 'versions', :action => 'show', :id => '1', |
|
74 | { :controller => 'versions', :action => 'show', :id => '1', | |
72 | :format => 'xml' } |
|
75 | :format => 'xml' } | |
73 | ) |
|
76 | ) | |
74 | assert_routing( |
|
77 | assert_routing( | |
75 | { :method => 'get', :path => "/versions/1.json" }, |
|
78 | { :method => 'get', :path => "/versions/1.json" }, | |
76 | { :controller => 'versions', :action => 'show', :id => '1', |
|
79 | { :controller => 'versions', :action => 'show', :id => '1', | |
77 | :format => 'json' } |
|
80 | :format => 'json' } | |
78 | ) |
|
81 | ) | |
79 | assert_routing( |
|
82 | assert_routing( | |
80 | { :method => 'get', :path => "/versions/1/edit" }, |
|
83 | { :method => 'get', :path => "/versions/1/edit" }, | |
81 | { :controller => 'versions', :action => 'edit', :id => '1' } |
|
84 | { :controller => 'versions', :action => 'edit', :id => '1' } | |
82 | ) |
|
85 | ) | |
83 | assert_routing( |
|
86 | assert_routing( | |
84 | { :method => 'put', :path => "/versions/1" }, |
|
87 | { :method => 'put', :path => "/versions/1" }, | |
85 | { :controller => 'versions', :action => 'update', :id => '1' } |
|
88 | { :controller => 'versions', :action => 'update', :id => '1' } | |
86 | ) |
|
89 | ) | |
87 | assert_routing( |
|
90 | assert_routing( | |
88 | { :method => 'put', :path => "/versions/1.xml" }, |
|
91 | { :method => 'put', :path => "/versions/1.xml" }, | |
89 | { :controller => 'versions', :action => 'update', :id => '1', |
|
92 | { :controller => 'versions', :action => 'update', :id => '1', | |
90 | :format => 'xml' } |
|
93 | :format => 'xml' } | |
91 | ) |
|
94 | ) | |
92 | assert_routing( |
|
95 | assert_routing( | |
93 | { :method => 'put', :path => "/versions/1.json" }, |
|
96 | { :method => 'put', :path => "/versions/1.json" }, | |
94 | { :controller => 'versions', :action => 'update', :id => '1', |
|
97 | { :controller => 'versions', :action => 'update', :id => '1', | |
95 | :format => 'json' } |
|
98 | :format => 'json' } | |
96 | ) |
|
99 | ) | |
97 | assert_routing( |
|
100 | assert_routing( | |
98 | { :method => 'delete', :path => "/versions/1" }, |
|
101 | { :method => 'delete', :path => "/versions/1" }, | |
99 | { :controller => 'versions', :action => 'destroy', :id => '1' } |
|
102 | { :controller => 'versions', :action => 'destroy', :id => '1' } | |
100 | ) |
|
103 | ) | |
101 | assert_routing( |
|
104 | assert_routing( | |
102 | { :method => 'delete', :path => "/versions/1.xml" }, |
|
105 | { :method => 'delete', :path => "/versions/1.xml" }, | |
103 | { :controller => 'versions', :action => 'destroy', :id => '1', |
|
106 | { :controller => 'versions', :action => 'destroy', :id => '1', | |
104 | :format => 'xml' } |
|
107 | :format => 'xml' } | |
105 | ) |
|
108 | ) | |
106 | assert_routing( |
|
109 | assert_routing( | |
107 | { :method => 'delete', :path => "/versions/1.json" }, |
|
110 | { :method => 'delete', :path => "/versions/1.json" }, | |
108 | { :controller => 'versions', :action => 'destroy', :id => '1', |
|
111 | { :controller => 'versions', :action => 'destroy', :id => '1', | |
109 | :format => 'json' } |
|
112 | :format => 'json' } | |
110 | ) |
|
113 | ) | |
111 | assert_routing( |
|
114 | assert_routing( | |
112 | { :method => 'post', :path => "/versions/1/status_by" }, |
|
115 | { :method => 'post', :path => "/versions/1/status_by" }, | |
113 | { :controller => 'versions', :action => 'status_by', :id => '1' } |
|
116 | { :controller => 'versions', :action => 'status_by', :id => '1' } | |
114 | ) |
|
117 | ) | |
115 | end |
|
118 | end | |
116 | end |
|
119 | end |
General Comments 0
You need to be logged in to leave comments.
Login now