annotate .svn/pristine/19/19c2933293d5536cb86e9ab59b2a501d3507d1a0.svn-base @ 1298:4f746d8966dd redmine_2.3_integration

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