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