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