@@ -1,86 +1,89 | |||
|
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 RoutingNewsTest < ActionController::IntegrationTest |
|
21 | 21 | def test_news |
|
22 | 22 | assert_routing( |
|
23 | 23 | { :method => 'get', :path => "/news" }, |
|
24 | 24 | { :controller => 'news', :action => 'index' } |
|
25 | 25 | ) |
|
26 | 26 | assert_routing( |
|
27 | 27 | { :method => 'get', :path => "/news.atom" }, |
|
28 | 28 | { :controller => 'news', :action => 'index', :format => 'atom' } |
|
29 | 29 | ) |
|
30 | 30 | assert_routing( |
|
31 | 31 | { :method => 'get', :path => "/news.xml" }, |
|
32 | 32 | { :controller => 'news', :action => 'index', :format => 'xml' } |
|
33 | 33 | ) |
|
34 | 34 | assert_routing( |
|
35 | 35 | { :method => 'get', :path => "/news.json" }, |
|
36 | 36 | { :controller => 'news', :action => 'index', :format => 'json' } |
|
37 | 37 | ) |
|
38 | 38 | assert_routing( |
|
39 | { :method => 'get', :path => "/news/2" }, | |
|
40 | { :controller => 'news', :action => 'show', :id => '2' } | |
|
41 | ) | |
|
42 | assert_routing( | |
|
43 | { :method => 'get', :path => "/news/234" }, | |
|
44 | { :controller => 'news', :action => 'show', :id => '234' } | |
|
45 | ) | |
|
46 | assert_routing( | |
|
47 | { :method => 'get', :path => "/news/567/edit" }, | |
|
48 | { :controller => 'news', :action => 'edit', :id => '567' } | |
|
49 | ) | |
|
50 | assert_routing( | |
|
51 | { :method => 'put', :path => "/news/567" }, | |
|
52 | { :controller => 'news', :action => 'update', :id => '567' } | |
|
53 | ) | |
|
54 | assert_routing( | |
|
55 | { :method => 'delete', :path => "/news/567" }, | |
|
56 | { :controller => 'news', :action => 'destroy', :id => '567' } | |
|
57 | ) | |
|
58 | end | |
|
59 | ||
|
60 | def test_news_scoped_under_project | |
|
61 | assert_routing( | |
|
39 | 62 | { :method => 'get', :path => "/projects/567/news" }, |
|
40 | 63 | { :controller => 'news', :action => 'index', :project_id => '567' } |
|
41 | 64 | ) |
|
42 | 65 | assert_routing( |
|
43 | 66 | { :method => 'get', :path => "/projects/567/news.atom" }, |
|
44 | 67 | { :controller => 'news', :action => 'index', :format => 'atom', |
|
45 | 68 | :project_id => '567' } |
|
46 | 69 | ) |
|
47 | 70 | assert_routing( |
|
48 | 71 | { :method => 'get', :path => "/projects/567/news.xml" }, |
|
49 | 72 | { :controller => 'news', :action => 'index', :format => 'xml', |
|
50 | 73 | :project_id => '567' } |
|
51 | 74 | ) |
|
52 | 75 | assert_routing( |
|
53 | 76 | { :method => 'get', :path => "/projects/567/news.json" }, |
|
54 | 77 | { :controller => 'news', :action => 'index', :format => 'json', |
|
55 | 78 | :project_id => '567' } |
|
56 | 79 | ) |
|
57 | 80 | assert_routing( |
|
58 | { :method => 'get', :path => "/news/2" }, | |
|
59 | { :controller => 'news', :action => 'show', :id => '2' } | |
|
60 | ) | |
|
61 | assert_routing( | |
|
62 | 81 | { :method => 'get', :path => "/projects/567/news/new" }, |
|
63 | 82 | { :controller => 'news', :action => 'new', :project_id => '567' } |
|
64 | 83 | ) |
|
65 | 84 | assert_routing( |
|
66 | { :method => 'get', :path => "/news/234" }, | |
|
67 | { :controller => 'news', :action => 'show', :id => '234' } | |
|
68 | ) | |
|
69 | assert_routing( | |
|
70 | { :method => 'get', :path => "/news/567/edit" }, | |
|
71 | { :controller => 'news', :action => 'edit', :id => '567' } | |
|
72 | ) | |
|
73 | assert_routing( | |
|
74 | 85 | { :method => 'post', :path => "/projects/567/news" }, |
|
75 | 86 | { :controller => 'news', :action => 'create', :project_id => '567' } |
|
76 | 87 | ) |
|
77 | assert_routing( | |
|
78 | { :method => 'put', :path => "/news/567" }, | |
|
79 | { :controller => 'news', :action => 'update', :id => '567' } | |
|
80 | ) | |
|
81 | assert_routing( | |
|
82 | { :method => 'delete', :path => "/news/567" }, | |
|
83 | { :controller => 'news', :action => 'destroy', :id => '567' } | |
|
84 | ) | |
|
85 | 88 | end |
|
86 | 89 | end |
General Comments 0
You need to be logged in to leave comments.
Login now