##// END OF EJS Templates
test: route: move repositories test to new file...
Toshi MARUYAMA -
r8220:c7d96d144119
parent child
Show More
@@ -0,0 +1,126
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 require File.expand_path('../../../test_helper', __FILE__)
19
20 class RoutingRepositoriesTest < ActionController::IntegrationTest
21 def test_repositories
22 assert_routing(
23 { :method => 'get',
24 :path => "/projects/redmine/repository" },
25 { :controller => 'repositories', :action => 'show', :id => 'redmine' }
26 )
27 assert_routing(
28 { :method => 'get',
29 :path => "/projects/redmine/repository/edit" },
30 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
31 )
32 assert_routing(
33 { :method => 'get',
34 :path => "/projects/redmine/repository/revisions" },
35 { :controller => 'repositories', :action => 'revisions', :id => 'redmine' }
36 )
37 assert_routing(
38 { :method => 'get',
39 :path => "/projects/redmine/repository/revisions.atom" },
40 { :controller => 'repositories', :action => 'revisions', :id => 'redmine',
41 :format => 'atom' }
42 )
43 assert_routing(
44 { :method => 'get',
45 :path => "/projects/redmine/repository/revisions/2457" },
46 { :controller => 'repositories', :action => 'revision', :id => 'redmine',
47 :rev => '2457' }
48 )
49 assert_routing(
50 { :method => 'get',
51 :path => "/projects/redmine/repository/revisions/2457/diff" },
52 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
53 :rev => '2457' }
54 )
55 assert_routing(
56 { :method => 'get',
57 :path => "/projects/redmine/repository/revisions/2457/diff.diff" },
58 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
59 :rev => '2457', :format => 'diff' }
60 )
61 assert_routing(
62 { :method => 'get',
63 :path => "/projects/redmine/repository/diff/path/to/file.c" },
64 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
65 :path => %w[path to file.c] }
66 )
67 assert_routing(
68 { :method => 'get',
69 :path => "/projects/redmine/repository/revisions/2/diff/path/to/file.c" },
70 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
71 :path => %w[path to file.c], :rev => '2' }
72 )
73 assert_routing(
74 { :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 )
79 assert_routing(
80 { :method => 'get',
81 :path => "/projects/redmine/repository/entry/path/to/file.c" },
82 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
83 :path => %w[path to file.c] }
84 )
85 assert_routing(
86 { :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' }
90 )
91 assert_routing(
92 { :method => 'get',
93 :path => "/projects/redmine/repository/raw/path/to/file.c" },
94 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
95 :path => %w[path to file.c], :format => 'raw' }
96 )
97 assert_routing(
98 { :method => 'get',
99 :path => "/projects/redmine/repository/revisions/2/raw/path/to/file.c" },
100 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
101 :path => %w[path to file.c], :rev => '2', :format => 'raw' }
102 )
103 assert_routing(
104 { :method => 'get',
105 :path => "/projects/redmine/repository/annotate/path/to/file.c" },
106 { :controller => 'repositories', :action => 'annotate', :id => 'redmine',
107 :path => %w[path to file.c] }
108 )
109 assert_routing(
110 { :method => 'get',
111 :path => "/projects/redmine/repository/changes/path/to/file.c" },
112 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
113 :path => %w[path to file.c] }
114 )
115 assert_routing(
116 { :method => 'get',
117 :path => "/projects/redmine/repository/statistics" },
118 { :controller => 'repositories', :action => 'stats', :id => 'redmine' }
119 )
120 assert_routing(
121 { :method => 'post',
122 :path => "/projects/redmine/repository/edit" },
123 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
124 )
125 end
126 end
@@ -465,112 +465,6 class RoutingTest < ActionController::IntegrationTest
465 )
465 )
466 end
466 end
467
467
468 def test_repositories
469 assert_routing(
470 { :method => 'get',
471 :path => "/projects/redmine/repository" },
472 { :controller => 'repositories', :action => 'show', :id => 'redmine' }
473 )
474 assert_routing(
475 { :method => 'get',
476 :path => "/projects/redmine/repository/edit" },
477 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
478 )
479 assert_routing(
480 { :method => 'get',
481 :path => "/projects/redmine/repository/revisions" },
482 { :controller => 'repositories', :action => 'revisions', :id => 'redmine' }
483 )
484 assert_routing(
485 { :method => 'get',
486 :path => "/projects/redmine/repository/revisions.atom" },
487 { :controller => 'repositories', :action => 'revisions', :id => 'redmine',
488 :format => 'atom' }
489 )
490 assert_routing(
491 { :method => 'get',
492 :path => "/projects/redmine/repository/revisions/2457" },
493 { :controller => 'repositories', :action => 'revision', :id => 'redmine',
494 :rev => '2457' }
495 )
496 assert_routing(
497 { :method => 'get',
498 :path => "/projects/redmine/repository/revisions/2457/diff" },
499 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
500 :rev => '2457' }
501 )
502 assert_routing(
503 { :method => 'get',
504 :path => "/projects/redmine/repository/revisions/2457/diff.diff" },
505 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
506 :rev => '2457', :format => 'diff' }
507 )
508 assert_routing(
509 { :method => 'get',
510 :path => "/projects/redmine/repository/diff/path/to/file.c" },
511 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
512 :path => %w[path to file.c] }
513 )
514 assert_routing(
515 { :method => 'get',
516 :path => "/projects/redmine/repository/revisions/2/diff/path/to/file.c" },
517 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
518 :path => %w[path to file.c], :rev => '2' }
519 )
520 assert_routing(
521 { :method => 'get',
522 :path => "/projects/redmine/repository/browse/path/to/file.c" },
523 { :controller => 'repositories', :action => 'browse', :id => 'redmine',
524 :path => %w[path to file.c] }
525 )
526 assert_routing(
527 { :method => 'get',
528 :path => "/projects/redmine/repository/entry/path/to/file.c" },
529 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
530 :path => %w[path to file.c] }
531 )
532 assert_routing(
533 { :method => 'get',
534 :path => "/projects/redmine/repository/revisions/2/entry/path/to/file.c" },
535 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
536 :path => %w[path to file.c], :rev => '2' }
537 )
538 assert_routing(
539 { :method => 'get',
540 :path => "/projects/redmine/repository/raw/path/to/file.c" },
541 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
542 :path => %w[path to file.c], :format => 'raw' }
543 )
544 assert_routing(
545 { :method => 'get',
546 :path => "/projects/redmine/repository/revisions/2/raw/path/to/file.c" },
547 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
548 :path => %w[path to file.c], :rev => '2', :format => 'raw' }
549 )
550 assert_routing(
551 { :method => 'get',
552 :path => "/projects/redmine/repository/annotate/path/to/file.c" },
553 { :controller => 'repositories', :action => 'annotate', :id => 'redmine',
554 :path => %w[path to file.c] }
555 )
556 assert_routing(
557 { :method => 'get',
558 :path => "/projects/redmine/repository/changes/path/to/file.c" },
559 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
560 :path => %w[path to file.c] }
561 )
562 assert_routing(
563 { :method => 'get',
564 :path => "/projects/redmine/repository/statistics" },
565 { :controller => 'repositories', :action => 'stats', :id => 'redmine' }
566 )
567 assert_routing(
568 { :method => 'post',
569 :path => "/projects/redmine/repository/edit" },
570 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
571 )
572 end
573
574 def test_roles
468 def test_roles
575 assert_routing(
469 assert_routing(
576 { :method => 'get', :path => "/roles" },
470 { :method => 'get', :path => "/roles" },
General Comments 0
You need to be logged in to leave comments. Login now