comparison test/unit/helpers/.svn/text-base/application_helper_test.rb.svn-base @ 246:eeebe205a056 cannam

* Merge from default branch, bringing us up to SVN trunk rev 4993
author Chris Cannam
date Thu, 03 Mar 2011 12:02:03 +0000
parents cd2282d2aa55 051f544170fe
children 753f1380d6bc
comparison
equal deleted inserted replaced
138:fca2657f4aa5 246:eeebe205a056
198 'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext.merge(:anchor => 'L110'), :class => 'source'), 198 'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext.merge(:anchor => 'L110'), :class => 'source'),
199 'source:/some/file@52#L110' => link_to('source:/some/file@52#L110', source_url.merge(:rev => 52, :anchor => 'L110'), :class => 'source'), 199 'source:/some/file@52#L110' => link_to('source:/some/file@52#L110', source_url.merge(:rev => 52, :anchor => 'L110'), :class => 'source'),
200 'export:/some/file' => link_to('export:/some/file', source_url.merge(:format => 'raw'), :class => 'source download'), 200 'export:/some/file' => link_to('export:/some/file', source_url.merge(:format => 'raw'), :class => 'source download'),
201 # message 201 # message
202 'message#4' => link_to('Post 2', message_url, :class => 'message'), 202 'message#4' => link_to('Post 2', message_url, :class => 'message'),
203 'message#5' => link_to('RE: post 2', message_url.merge(:anchor => 'message-5'), :class => 'message'), 203 'message#5' => link_to('RE: post 2', message_url.merge(:anchor => 'message-5', :r => 5), :class => 'message'),
204 # project 204 # project
205 'project#3' => link_to('eCookbook Subproject 1', project_url, :class => 'project'), 205 'project#3' => link_to('eCookbook Subproject 1', project_url, :class => 'project'),
206 'project:subproject1' => link_to('eCookbook Subproject 1', project_url, :class => 'project'), 206 'project:subproject1' => link_to('eCookbook Subproject 1', project_url, :class => 'project'),
207 'project:"eCookbook subProject 1"' => link_to('eCookbook Subproject 1', project_url, :class => 'project'), 207 'project:"eCookbook subProject 1"' => link_to('eCookbook Subproject 1', project_url, :class => 'project'),
208 # escaping 208 # escaping
222 "http://foo.bar/FAQ#3" => '<a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a>', 222 "http://foo.bar/FAQ#3" => '<a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a>',
223 } 223 }
224 @project = Project.find(1) 224 @project = Project.find(1)
225 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text), "#{text} failed" } 225 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text), "#{text} failed" }
226 end 226 end
227
228 def test_cross_project_redmine_links
229 source_link = link_to('ecookbook:source:/some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']},
230 :class => 'source')
231
232 changeset_link = link_to('ecookbook:r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2},
233 :class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3')
234
235 to_test = {
236 # documents
237 'document:"Test document"' => 'document:"Test document"',
238 'ecookbook:document:"Test document"' => '<a href="/documents/1" class="document">Test document</a>',
239 'invalid:document:"Test document"' => 'invalid:document:"Test document"',
240 # versions
241 'version:"1.0"' => 'version:"1.0"',
242 'ecookbook:version:"1.0"' => '<a href="/versions/show/2" class="version">1.0</a>',
243 'invalid:version:"1.0"' => 'invalid:version:"1.0"',
244 # changeset
245 'r2' => 'r2',
246 'ecookbook:r2' => changeset_link,
247 'invalid:r2' => 'invalid:r2',
248 # source
249 'source:/some/file' => 'source:/some/file',
250 'ecookbook:source:/some/file' => source_link,
251 'invalid:source:/some/file' => 'invalid:source:/some/file',
252 }
253 @project = Project.find(3)
254 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text), "#{text} failed" }
255 end
227 256
228 def test_redmine_links_git_commit 257 def test_redmine_links_git_commit
229 changeset_link = link_to('abcd', 258 changeset_link = link_to('abcd',
230 { 259 {
231 :controller => 'repositories', 260 :controller => 'repositories',
261 :class => 'changeset', :title => 'test commit') 290 :class => 'changeset', :title => 'test commit')
262 to_test = { 291 to_test = {
263 'commit:20080308225258-98289-abcd456efg.gz' => changeset_link, 292 'commit:20080308225258-98289-abcd456efg.gz' => changeset_link,
264 } 293 }
265 @project = Project.find(3) 294 @project = Project.find(3)
266 r = Repository::Darcs.create!(:project => @project, :url => '/tmp/test/darcs') 295 r = Repository::Darcs.create!(
296 :project => @project, :url => '/tmp/test/darcs',
297 :log_encoding => 'UTF-8')
267 assert r 298 assert r
268 c = Changeset.new(:repository => r, 299 c = Changeset.new(:repository => r,
269 :committed_on => Time.now, 300 :committed_on => Time.now,
270 :revision => '123', 301 :revision => '123',
271 :scmid => '20080308225258-98289-abcd456efg.gz', 302 :scmid => '20080308225258-98289-abcd456efg.gz',