##// END OF EJS Templates
test: route: simplify repositories test...
Toshi MARUYAMA -
r8376:5636228f798a
parent child
Show More
@@ -1,132 +1,129
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 RoutingRepositoriesTest < ActionController::IntegrationTest
21 21 def test_repositories
22 22 assert_routing(
23 23 { :method => 'get',
24 24 :path => "/projects/redmine/repository" },
25 25 { :controller => 'repositories', :action => 'show', :id => 'redmine' }
26 26 )
27 ["get", "post"].each do |method|
28 assert_routing(
29 { :method => method,
30 :path => "/projects/redmine/repository/edit" },
31 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
32 )
33 end
27 34 assert_routing(
28 35 { :method => 'get',
29 :path => "/projects/redmine/repository/edit" },
30 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
31 )
36 :path => "/projects/redmine/repository/statistics" },
37 { :controller => 'repositories', :action => 'stats', :id => 'redmine' }
38 )
32 39 end
33 40
34 41 def test_repositories_revisions
35 42 assert_routing(
36 43 { :method => 'get',
37 44 :path => "/projects/redmine/repository/revisions" },
38 45 { :controller => 'repositories', :action => 'revisions', :id => 'redmine' }
39 46 )
40 47 assert_routing(
41 48 { :method => 'get',
42 49 :path => "/projects/redmine/repository/revisions.atom" },
43 50 { :controller => 'repositories', :action => 'revisions', :id => 'redmine',
44 51 :format => 'atom' }
45 52 )
46 53 assert_routing(
47 54 { :method => 'get',
48 55 :path => "/projects/redmine/repository/revisions/2457" },
49 56 { :controller => 'repositories', :action => 'revision', :id => 'redmine',
50 57 :rev => '2457' }
51 58 )
52 59 assert_routing(
53 60 { :method => 'get',
54 61 :path => "/projects/redmine/repository/revisions/2457/diff" },
55 62 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
56 63 :rev => '2457' }
57 64 )
58 65 assert_routing(
59 66 { :method => 'get',
60 67 :path => "/projects/redmine/repository/revisions/2457/diff.diff" },
61 68 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
62 69 :rev => '2457', :format => 'diff' }
63 70 )
64 71 assert_routing(
65 72 { :method => 'get',
66 73 :path => "/projects/redmine/repository/revisions/2/diff/path/to/file.c" },
67 74 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
68 75 :path => %w[path to file.c], :rev => '2' }
69 76 )
70 77 assert_routing(
71 78 { :method => 'get',
72 79 :path => "/projects/redmine/repository/revisions/2/entry/path/to/file.c" },
73 80 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
74 81 :path => %w[path to file.c], :rev => '2' }
75 82 )
76 83 assert_routing(
77 84 { :method => 'get',
78 85 :path => "/projects/redmine/repository/revisions/2/raw/path/to/file.c" },
79 86 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
80 87 :path => %w[path to file.c], :rev => '2', :format => 'raw' }
81 88 )
82 89 end
83 90
84 def test_repositories_etc
91 def test_repositories_non_revisions_path
85 92 assert_routing(
86 93 { :method => 'get',
87 94 :path => "/projects/redmine/repository/diff/path/to/file.c" },
88 95 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
89 96 :path => %w[path to file.c] }
90 97 )
91 98 assert_routing(
92 99 { :method => 'get',
93 100 :path => "/projects/redmine/repository/browse/path/to/file.c" },
94 101 { :controller => 'repositories', :action => 'browse', :id => 'redmine',
95 102 :path => %w[path to file.c] }
96 103 )
97 104 assert_routing(
98 105 { :method => 'get',
99 106 :path => "/projects/redmine/repository/entry/path/to/file.c" },
100 107 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
101 108 :path => %w[path to file.c] }
102 109 )
103 110 assert_routing(
104 111 { :method => 'get',
105 112 :path => "/projects/redmine/repository/raw/path/to/file.c" },
106 113 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
107 114 :path => %w[path to file.c], :format => 'raw' }
108 115 )
109 116 assert_routing(
110 117 { :method => 'get',
111 118 :path => "/projects/redmine/repository/annotate/path/to/file.c" },
112 119 { :controller => 'repositories', :action => 'annotate', :id => 'redmine',
113 120 :path => %w[path to file.c] }
114 121 )
115 122 assert_routing(
116 123 { :method => 'get',
117 124 :path => "/projects/redmine/repository/changes/path/to/file.c" },
118 125 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
119 126 :path => %w[path to file.c] }
120 127 )
121 assert_routing(
122 { :method => 'get',
123 :path => "/projects/redmine/repository/statistics" },
124 { :controller => 'repositories', :action => 'stats', :id => 'redmine' }
125 )
126 assert_routing(
127 { :method => 'post',
128 :path => "/projects/redmine/repository/edit" },
129 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
130 )
131 128 end
132 129 end
General Comments 0
You need to be logged in to leave comments. Login now