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