##// END OF EJS Templates
test: route: split news tests...
Toshi MARUYAMA -
r8427:c5f41baa945f
parent child
Show More
@@ -1,89 +1,92
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 def test_news
21 def test_news_index
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 end
39
40 def test_news
38 41 assert_routing(
39 42 { :method => 'get', :path => "/news/2" },
40 43 { :controller => 'news', :action => 'show', :id => '2' }
41 44 )
42 45 assert_routing(
43 46 { :method => 'get', :path => "/news/234" },
44 47 { :controller => 'news', :action => 'show', :id => '234' }
45 48 )
46 49 assert_routing(
47 50 { :method => 'get', :path => "/news/567/edit" },
48 51 { :controller => 'news', :action => 'edit', :id => '567' }
49 52 )
50 53 assert_routing(
51 54 { :method => 'put', :path => "/news/567" },
52 55 { :controller => 'news', :action => 'update', :id => '567' }
53 56 )
54 57 assert_routing(
55 58 { :method => 'delete', :path => "/news/567" },
56 59 { :controller => 'news', :action => 'destroy', :id => '567' }
57 60 )
58 61 end
59 62
60 63 def test_news_scoped_under_project
61 64 assert_routing(
62 65 { :method => 'get', :path => "/projects/567/news" },
63 66 { :controller => 'news', :action => 'index', :project_id => '567' }
64 67 )
65 68 assert_routing(
66 69 { :method => 'get', :path => "/projects/567/news.atom" },
67 70 { :controller => 'news', :action => 'index', :format => 'atom',
68 71 :project_id => '567' }
69 72 )
70 73 assert_routing(
71 74 { :method => 'get', :path => "/projects/567/news.xml" },
72 75 { :controller => 'news', :action => 'index', :format => 'xml',
73 76 :project_id => '567' }
74 77 )
75 78 assert_routing(
76 79 { :method => 'get', :path => "/projects/567/news.json" },
77 80 { :controller => 'news', :action => 'index', :format => 'json',
78 81 :project_id => '567' }
79 82 )
80 83 assert_routing(
81 84 { :method => 'get', :path => "/projects/567/news/new" },
82 85 { :controller => 'news', :action => 'new', :project_id => '567' }
83 86 )
84 87 assert_routing(
85 88 { :method => 'post', :path => "/projects/567/news" },
86 89 { :controller => 'news', :action => 'create', :project_id => '567' }
87 90 )
88 91 end
89 92 end
General Comments 0
You need to be logged in to leave comments. Login now