annotate .svn/pristine/19/19c2933293d5536cb86e9ab59b2a501d3507d1a0.svn-base @ 1327:287f201c2802 redmine-2.2-integration

Add italic
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Wed, 19 Jun 2013 20:56:22 +0100
parents 038ba2d95de8
children
rev   line source
Chris@1296 1 # Redmine - project management software
Chris@1296 2 # Copyright (C) 2006-2012 Jean-Philippe Lang
Chris@1296 3 #
Chris@1296 4 # This program is free software; you can redistribute it and/or
Chris@1296 5 # modify it under the terms of the GNU General Public License
Chris@1296 6 # as published by the Free Software Foundation; either version 2
Chris@1296 7 # of the License, or (at your option) any later version.
Chris@1296 8 #
Chris@1296 9 # This program is distributed in the hope that it will be useful,
Chris@1296 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@1296 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@1296 12 # GNU General Public License for more details.
Chris@1296 13 #
Chris@1296 14 # You should have received a copy of the GNU General Public License
Chris@1296 15 # along with this program; if not, write to the Free Software
Chris@1296 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@1296 17
Chris@1296 18 require File.expand_path('../../../test_helper', __FILE__)
Chris@1296 19
Chris@1296 20 class RoutingWikiTest < ActionController::IntegrationTest
Chris@1296 21 def test_wiki_matching
Chris@1296 22 assert_routing(
Chris@1296 23 { :method => 'get', :path => "/projects/567/wiki" },
Chris@1296 24 { :controller => 'wiki', :action => 'show', :project_id => '567' }
Chris@1296 25 )
Chris@1296 26 assert_routing(
Chris@1296 27 { :method => 'get', :path => "/projects/567/wiki/lalala" },
Chris@1296 28 { :controller => 'wiki', :action => 'show', :project_id => '567',
Chris@1296 29 :id => 'lalala' }
Chris@1296 30 )
Chris@1296 31 assert_routing(
Chris@1296 32 { :method => 'get', :path => "/projects/567/wiki/lalala.pdf" },
Chris@1296 33 { :controller => 'wiki', :action => 'show', :project_id => '567',
Chris@1296 34 :id => 'lalala', :format => 'pdf' }
Chris@1296 35 )
Chris@1296 36 assert_routing(
Chris@1296 37 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
Chris@1296 38 { :controller => 'wiki', :action => 'diff', :project_id => '1',
Chris@1296 39 :id => 'CookBook_documentation' }
Chris@1296 40 )
Chris@1296 41 assert_routing(
Chris@1296 42 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2" },
Chris@1296 43 { :controller => 'wiki', :action => 'show', :project_id => '1',
Chris@1296 44 :id => 'CookBook_documentation', :version => '2' }
Chris@1296 45 )
Chris@1296 46 assert_routing(
Chris@1296 47 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2/diff" },
Chris@1296 48 { :controller => 'wiki', :action => 'diff', :project_id => '1',
Chris@1296 49 :id => 'CookBook_documentation', :version => '2' }
Chris@1296 50 )
Chris@1296 51 assert_routing(
Chris@1296 52 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2/annotate" },
Chris@1296 53 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
Chris@1296 54 :id => 'CookBook_documentation', :version => '2' }
Chris@1296 55 )
Chris@1296 56 end
Chris@1296 57
Chris@1296 58 def test_wiki_misc
Chris@1296 59 assert_routing(
Chris@1296 60 { :method => 'get', :path => "/projects/567/wiki/date_index" },
Chris@1296 61 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
Chris@1296 62 )
Chris@1296 63 assert_routing(
Chris@1296 64 { :method => 'get', :path => "/projects/567/wiki/export" },
Chris@1296 65 { :controller => 'wiki', :action => 'export', :project_id => '567' }
Chris@1296 66 )
Chris@1296 67 assert_routing(
Chris@1296 68 { :method => 'get', :path => "/projects/567/wiki/export.pdf" },
Chris@1296 69 { :controller => 'wiki', :action => 'export', :project_id => '567', :format => 'pdf' }
Chris@1296 70 )
Chris@1296 71 assert_routing(
Chris@1296 72 { :method => 'get', :path => "/projects/567/wiki/index" },
Chris@1296 73 { :controller => 'wiki', :action => 'index', :project_id => '567' }
Chris@1296 74 )
Chris@1296 75 end
Chris@1296 76
Chris@1296 77 def test_wiki_resources
Chris@1296 78 assert_routing(
Chris@1296 79 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
Chris@1296 80 { :controller => 'wiki', :action => 'edit', :project_id => '567',
Chris@1296 81 :id => 'my_page' }
Chris@1296 82 )
Chris@1296 83 assert_routing(
Chris@1296 84 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
Chris@1296 85 { :controller => 'wiki', :action => 'history', :project_id => '1',
Chris@1296 86 :id => 'CookBook_documentation' }
Chris@1296 87 )
Chris@1296 88 assert_routing(
Chris@1296 89 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
Chris@1296 90 { :controller => 'wiki', :action => 'rename', :project_id => '22',
Chris@1296 91 :id => 'ladida' }
Chris@1296 92 )
Chris@1296 93 ["post", "put"].each do |method|
Chris@1296 94 assert_routing(
Chris@1296 95 { :method => method, :path => "/projects/567/wiki/CookBook_documentation/preview" },
Chris@1296 96 { :controller => 'wiki', :action => 'preview', :project_id => '567',
Chris@1296 97 :id => 'CookBook_documentation' }
Chris@1296 98 )
Chris@1296 99 end
Chris@1296 100 assert_routing(
Chris@1296 101 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
Chris@1296 102 { :controller => 'wiki', :action => 'rename', :project_id => '22',
Chris@1296 103 :id => 'ladida' }
Chris@1296 104 )
Chris@1296 105 assert_routing(
Chris@1296 106 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
Chris@1296 107 { :controller => 'wiki', :action => 'protect', :project_id => '22',
Chris@1296 108 :id => 'ladida' }
Chris@1296 109 )
Chris@1296 110 assert_routing(
Chris@1296 111 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
Chris@1296 112 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
Chris@1296 113 :id => 'ladida' }
Chris@1296 114 )
Chris@1296 115 assert_routing(
Chris@1296 116 { :method => 'put', :path => "/projects/567/wiki/my_page" },
Chris@1296 117 { :controller => 'wiki', :action => 'update', :project_id => '567',
Chris@1296 118 :id => 'my_page' }
Chris@1296 119 )
Chris@1296 120 assert_routing(
Chris@1296 121 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
Chris@1296 122 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
Chris@1296 123 :id => 'ladida' }
Chris@1296 124 )
Chris@1296 125 assert_routing(
Chris@1296 126 { :method => 'delete', :path => "/projects/22/wiki/ladida/3" },
Chris@1296 127 { :controller => 'wiki', :action => 'destroy_version', :project_id => '22',
Chris@1296 128 :id => 'ladida', :version => '3' }
Chris@1296 129 )
Chris@1296 130 end
Chris@1296 131
Chris@1296 132 def test_api
Chris@1296 133 assert_routing(
Chris@1296 134 { :method => 'get', :path => "/projects/567/wiki/my_page.xml" },
Chris@1296 135 { :controller => 'wiki', :action => 'show', :project_id => '567',
Chris@1296 136 :id => 'my_page', :format => 'xml' }
Chris@1296 137 )
Chris@1296 138 assert_routing(
Chris@1296 139 { :method => 'get', :path => "/projects/567/wiki/my_page.json" },
Chris@1296 140 { :controller => 'wiki', :action => 'show', :project_id => '567',
Chris@1296 141 :id => 'my_page', :format => 'json' }
Chris@1296 142 )
Chris@1296 143 assert_routing(
Chris@1296 144 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2.xml" },
Chris@1296 145 { :controller => 'wiki', :action => 'show', :project_id => '1',
Chris@1296 146 :id => 'CookBook_documentation', :version => '2', :format => 'xml' }
Chris@1296 147 )
Chris@1296 148 assert_routing(
Chris@1296 149 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2.json" },
Chris@1296 150 { :controller => 'wiki', :action => 'show', :project_id => '1',
Chris@1296 151 :id => 'CookBook_documentation', :version => '2', :format => 'json' }
Chris@1296 152 )
Chris@1296 153 assert_routing(
Chris@1296 154 { :method => 'get', :path => "/projects/567/wiki/index.xml" },
Chris@1296 155 { :controller => 'wiki', :action => 'index', :project_id => '567', :format => 'xml' }
Chris@1296 156 )
Chris@1296 157 assert_routing(
Chris@1296 158 { :method => 'get', :path => "/projects/567/wiki/index.json" },
Chris@1296 159 { :controller => 'wiki', :action => 'index', :project_id => '567', :format => 'json' }
Chris@1296 160 )
Chris@1296 161 assert_routing(
Chris@1296 162 { :method => 'put', :path => "/projects/567/wiki/my_page.xml" },
Chris@1296 163 { :controller => 'wiki', :action => 'update', :project_id => '567',
Chris@1296 164 :id => 'my_page', :format => 'xml' }
Chris@1296 165 )
Chris@1296 166 assert_routing(
Chris@1296 167 { :method => 'put', :path => "/projects/567/wiki/my_page.json" },
Chris@1296 168 { :controller => 'wiki', :action => 'update', :project_id => '567',
Chris@1296 169 :id => 'my_page', :format => 'json' }
Chris@1296 170 )
Chris@1296 171 assert_routing(
Chris@1296 172 { :method => 'delete', :path => "/projects/567/wiki/my_page.xml" },
Chris@1296 173 { :controller => 'wiki', :action => 'destroy', :project_id => '567',
Chris@1296 174 :id => 'my_page', :format => 'xml' }
Chris@1296 175 )
Chris@1296 176 assert_routing(
Chris@1296 177 { :method => 'delete', :path => "/projects/567/wiki/my_page.json" },
Chris@1296 178 { :controller => 'wiki', :action => 'destroy', :project_id => '567',
Chris@1296 179 :id => 'my_page', :format => 'json' }
Chris@1296 180 )
Chris@1296 181 end
Chris@1296 182 end