##// END OF EJS Templates
test: route: split versions tests whether scoped under project or not...
Toshi MARUYAMA -
r8316:11946ecd876f
parent child
Show More
@@ -1,113 +1,116
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
21 def test_versions_scoped_under_project
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 assert_routing(
27 assert_routing(
28 { :method => 'put', :path => "/projects/foo/versions/close_completed" },
29 { :controller => 'versions', :action => 'close_completed',
30 :project_id => 'foo' }
31 )
32 assert_routing(
28 { :method => 'get', :path => "/projects/foo/versions.xml" },
33 { :method => 'get', :path => "/projects/foo/versions.xml" },
29 { :controller => 'versions', :action => 'index',
34 { :controller => 'versions', :action => 'index',
30 :project_id => 'foo', :format => 'xml' }
35 :project_id => 'foo', :format => 'xml' }
31 )
36 )
32 assert_routing(
37 assert_routing(
33 { :method => 'get', :path => "/projects/foo/versions.json" },
38 { :method => 'get', :path => "/projects/foo/versions.json" },
34 { :controller => 'versions', :action => 'index',
39 { :controller => 'versions', :action => 'index',
35 :project_id => 'foo', :format => 'json' }
40 :project_id => 'foo', :format => 'json' }
36 )
41 )
37 assert_routing(
42 assert_routing(
38 { :method => 'get', :path => "/projects/foo/versions/new" },
43 { :method => 'get', :path => "/projects/foo/versions/new" },
39 { :controller => 'versions', :action => 'new',
44 { :controller => 'versions', :action => 'new',
40 :project_id => 'foo' }
45 :project_id => 'foo' }
41 )
46 )
42 assert_routing(
47 assert_routing(
43 { :method => 'post', :path => "/projects/foo/versions" },
48 { :method => 'post', :path => "/projects/foo/versions" },
44 { :controller => 'versions', :action => 'create',
49 { :controller => 'versions', :action => 'create',
45 :project_id => 'foo' }
50 :project_id => 'foo' }
46 )
51 )
47 assert_routing(
52 assert_routing(
48 { :method => 'post', :path => "/projects/foo/versions.xml" },
53 { :method => 'post', :path => "/projects/foo/versions.xml" },
49 { :controller => 'versions', :action => 'create',
54 { :controller => 'versions', :action => 'create',
50 :project_id => 'foo', :format => 'xml' }
55 :project_id => 'foo', :format => 'xml' }
51 )
56 )
52 assert_routing(
57 assert_routing(
53 { :method => 'post', :path => "/projects/foo/versions.json" },
58 { :method => 'post', :path => "/projects/foo/versions.json" },
54 { :controller => 'versions', :action => 'create',
59 { :controller => 'versions', :action => 'create',
55 :project_id => 'foo', :format => 'json' }
60 :project_id => 'foo', :format => 'json' }
56 )
61 )
62 end
63
64 def test_versions
57 assert_routing(
65 assert_routing(
58 { :method => 'get', :path => "/versions/1" },
66 { :method => 'get', :path => "/versions/1" },
59 { :controller => 'versions', :action => 'show', :id => '1' }
67 { :controller => 'versions', :action => 'show', :id => '1' }
60 )
68 )
61 assert_routing(
69 assert_routing(
62 { :method => 'get', :path => "/versions/1.xml" },
70 { :method => 'get', :path => "/versions/1.xml" },
63 { :controller => 'versions', :action => 'show', :id => '1',
71 { :controller => 'versions', :action => 'show', :id => '1',
64 :format => 'xml' }
72 :format => 'xml' }
65 )
73 )
66 assert_routing(
74 assert_routing(
67 { :method => 'get', :path => "/versions/1.json" },
75 { :method => 'get', :path => "/versions/1.json" },
68 { :controller => 'versions', :action => 'show', :id => '1',
76 { :controller => 'versions', :action => 'show', :id => '1',
69 :format => 'json' }
77 :format => 'json' }
70 )
78 )
71 assert_routing(
79 assert_routing(
72 { :method => 'get', :path => "/versions/1/edit" },
80 { :method => 'get', :path => "/versions/1/edit" },
73 { :controller => 'versions', :action => 'edit', :id => '1' }
81 { :controller => 'versions', :action => 'edit', :id => '1' }
74 )
82 )
75 assert_routing(
83 assert_routing(
76 { :method => 'put', :path => "/versions/1" },
84 { :method => 'put', :path => "/versions/1" },
77 { :controller => 'versions', :action => 'update', :id => '1' }
85 { :controller => 'versions', :action => 'update', :id => '1' }
78 )
86 )
79 assert_routing(
87 assert_routing(
80 { :method => 'put', :path => "/versions/1.xml" },
88 { :method => 'put', :path => "/versions/1.xml" },
81 { :controller => 'versions', :action => 'update', :id => '1',
89 { :controller => 'versions', :action => 'update', :id => '1',
82 :format => 'xml' }
90 :format => 'xml' }
83 )
91 )
84 assert_routing(
92 assert_routing(
85 { :method => 'put', :path => "/versions/1.json" },
93 { :method => 'put', :path => "/versions/1.json" },
86 { :controller => 'versions', :action => 'update', :id => '1',
94 { :controller => 'versions', :action => 'update', :id => '1',
87 :format => 'json' }
95 :format => 'json' }
88 )
96 )
89 assert_routing(
97 assert_routing(
90 { :method => 'delete', :path => "/versions/1" },
98 { :method => 'delete', :path => "/versions/1" },
91 { :controller => 'versions', :action => 'destroy', :id => '1' }
99 { :controller => 'versions', :action => 'destroy', :id => '1' }
92 )
100 )
93 assert_routing(
101 assert_routing(
94 { :method => 'delete', :path => "/versions/1.xml" },
102 { :method => 'delete', :path => "/versions/1.xml" },
95 { :controller => 'versions', :action => 'destroy', :id => '1',
103 { :controller => 'versions', :action => 'destroy', :id => '1',
96 :format => 'xml' }
104 :format => 'xml' }
97 )
105 )
98 assert_routing(
106 assert_routing(
99 { :method => 'delete', :path => "/versions/1.json" },
107 { :method => 'delete', :path => "/versions/1.json" },
100 { :controller => 'versions', :action => 'destroy', :id => '1',
108 { :controller => 'versions', :action => 'destroy', :id => '1',
101 :format => 'json' }
109 :format => 'json' }
102 )
110 )
103 assert_routing(
111 assert_routing(
104 { :method => 'put', :path => "/projects/foo/versions/close_completed" },
105 { :controller => 'versions', :action => 'close_completed',
106 :project_id => 'foo' }
107 )
108 assert_routing(
109 { :method => 'post', :path => "/versions/1/status_by" },
112 { :method => 'post', :path => "/versions/1/status_by" },
110 { :controller => 'versions', :action => 'status_by', :id => '1' }
113 { :controller => 'versions', :action => 'status_by', :id => '1' }
111 )
114 )
112 end
115 end
113 end
116 end
General Comments 0
You need to be logged in to leave comments. Login now