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