To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / .svn / pristine / b2 / b2e850115d38f72b8bb02be2b155cf948264198f.svn-base @ 1297:0a574315af3e
History | View | Annotate | Download (3.36 KB)
| 1 | 1296:038ba2d95de8 | Chris | # Redmine - project management software |
|---|---|---|---|
| 2 | # Copyright (C) 2006-2012 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 RoutingNewsTest < ActionController::IntegrationTest |
||
| 21 | def test_news_index |
||
| 22 | assert_routing( |
||
| 23 | { :method => 'get', :path => "/news" },
|
||
| 24 | { :controller => 'news', :action => 'index' }
|
||
| 25 | ) |
||
| 26 | assert_routing( |
||
| 27 | { :method => 'get', :path => "/news.atom" },
|
||
| 28 | { :controller => 'news', :action => 'index', :format => 'atom' }
|
||
| 29 | ) |
||
| 30 | assert_routing( |
||
| 31 | { :method => 'get', :path => "/news.xml" },
|
||
| 32 | { :controller => 'news', :action => 'index', :format => 'xml' }
|
||
| 33 | ) |
||
| 34 | assert_routing( |
||
| 35 | { :method => 'get', :path => "/news.json" },
|
||
| 36 | { :controller => 'news', :action => 'index', :format => 'json' }
|
||
| 37 | ) |
||
| 38 | end |
||
| 39 | |||
| 40 | def test_news |
||
| 41 | assert_routing( |
||
| 42 | { :method => 'get', :path => "/news/2" },
|
||
| 43 | { :controller => 'news', :action => 'show', :id => '2' }
|
||
| 44 | ) |
||
| 45 | assert_routing( |
||
| 46 | { :method => 'get', :path => "/news/234" },
|
||
| 47 | { :controller => 'news', :action => 'show', :id => '234' }
|
||
| 48 | ) |
||
| 49 | assert_routing( |
||
| 50 | { :method => 'get', :path => "/news/567/edit" },
|
||
| 51 | { :controller => 'news', :action => 'edit', :id => '567' }
|
||
| 52 | ) |
||
| 53 | assert_routing( |
||
| 54 | { :method => 'put', :path => "/news/567" },
|
||
| 55 | { :controller => 'news', :action => 'update', :id => '567' }
|
||
| 56 | ) |
||
| 57 | assert_routing( |
||
| 58 | { :method => 'delete', :path => "/news/567" },
|
||
| 59 | { :controller => 'news', :action => 'destroy', :id => '567' }
|
||
| 60 | ) |
||
| 61 | end |
||
| 62 | |||
| 63 | def test_news_scoped_under_project |
||
| 64 | assert_routing( |
||
| 65 | { :method => 'get', :path => "/projects/567/news" },
|
||
| 66 | { :controller => 'news', :action => 'index', :project_id => '567' }
|
||
| 67 | ) |
||
| 68 | assert_routing( |
||
| 69 | { :method => 'get', :path => "/projects/567/news.atom" },
|
||
| 70 | { :controller => 'news', :action => 'index', :format => 'atom',
|
||
| 71 | :project_id => '567' } |
||
| 72 | ) |
||
| 73 | assert_routing( |
||
| 74 | { :method => 'get', :path => "/projects/567/news.xml" },
|
||
| 75 | { :controller => 'news', :action => 'index', :format => 'xml',
|
||
| 76 | :project_id => '567' } |
||
| 77 | ) |
||
| 78 | assert_routing( |
||
| 79 | { :method => 'get', :path => "/projects/567/news.json" },
|
||
| 80 | { :controller => 'news', :action => 'index', :format => 'json',
|
||
| 81 | :project_id => '567' } |
||
| 82 | ) |
||
| 83 | assert_routing( |
||
| 84 | { :method => 'get', :path => "/projects/567/news/new" },
|
||
| 85 | { :controller => 'news', :action => 'new', :project_id => '567' }
|
||
| 86 | ) |
||
| 87 | assert_routing( |
||
| 88 | { :method => 'post', :path => "/projects/567/news" },
|
||
| 89 | { :controller => 'news', :action => 'create', :project_id => '567' }
|
||
| 90 | ) |
||
| 91 | end |
||
| 92 | end |