Mercurial > hg > soundsoftware-site
comparison test/unit/helpers/application_helper_test.rb @ 1294:3e4c3460b6ca redmine-2.2
Update to Redmine SVN revision 11972 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:01:12 +0100 |
parents | 433d4f72a19b |
children | 622f24f53b42 0a574315af3e 261b3d9a4903 |
comparison
equal
deleted
inserted
replaced
1115:433d4f72a19b | 1294:3e4c3460b6ca |
---|---|
345 } | 345 } |
346 @project = Project.find(1) | 346 @project = Project.find(1) |
347 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text), "#{text} failed" } | 347 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text), "#{text} failed" } |
348 end | 348 end |
349 | 349 |
350 def test_redmine_links_with_a_different_project_before_current_project | |
351 vp1 = Version.generate!(:project_id => 1, :name => '1.4.4') | |
352 vp3 = Version.generate!(:project_id => 3, :name => '1.4.4') | |
353 | |
354 @project = Project.find(3) | |
355 assert_equal %(<p><a href="/versions/#{vp1.id}" class="version">1.4.4</a> <a href="/versions/#{vp3.id}" class="version">1.4.4</a></p>), | |
356 textilizable("ecookbook:version:1.4.4 version:1.4.4") | |
357 end | |
358 | |
350 def test_escaped_redmine_links_should_not_be_parsed | 359 def test_escaped_redmine_links_should_not_be_parsed |
351 to_test = [ | 360 to_test = [ |
352 '#3.', | 361 '#3.', |
353 '#3-14.', | 362 '#3-14.', |
354 '#3#-note14.', | 363 '#3#-note14.', |
392 @project = Project.find(3) | 401 @project = Project.find(3) |
393 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text), "#{text} failed" } | 402 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text), "#{text} failed" } |
394 end | 403 end |
395 | 404 |
396 def test_multiple_repositories_redmine_links | 405 def test_multiple_repositories_redmine_links |
397 svn = Repository::Subversion.create!(:project_id => 1, :identifier => 'svn1', :url => 'file:///foo/hg') | 406 svn = Repository::Subversion.create!(:project_id => 1, :identifier => 'svn_repo-1', :url => 'file:///foo/hg') |
398 Changeset.create!(:repository => svn, :committed_on => Time.now, :revision => '123') | 407 Changeset.create!(:repository => svn, :committed_on => Time.now, :revision => '123') |
399 hg = Repository::Mercurial.create!(:project_id => 1, :identifier => 'hg1', :url => '/foo/hg') | 408 hg = Repository::Mercurial.create!(:project_id => 1, :identifier => 'hg1', :url => '/foo/hg') |
400 Changeset.create!(:repository => hg, :committed_on => Time.now, :revision => '123', :scmid => 'abcd') | 409 Changeset.create!(:repository => hg, :committed_on => Time.now, :revision => '123', :scmid => 'abcd') |
401 | 410 |
402 changeset_link = link_to('r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2}, | 411 changeset_link = link_to('r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2}, |
403 :class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3') | 412 :class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3') |
404 svn_changeset_link = link_to('svn1|r123', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'svn1', :rev => 123}, | 413 svn_changeset_link = link_to('svn_repo-1|r123', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'svn_repo-1', :rev => 123}, |
405 :class => 'changeset', :title => '') | 414 :class => 'changeset', :title => '') |
406 hg_changeset_link = link_to('hg1|abcd', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'hg1', :rev => 'abcd'}, | 415 hg_changeset_link = link_to('hg1|abcd', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'hg1', :rev => 'abcd'}, |
407 :class => 'changeset', :title => '') | 416 :class => 'changeset', :title => '') |
408 | 417 |
409 source_link = link_to('source:some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}, :class => 'source') | 418 source_link = link_to('source:some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}, :class => 'source') |
410 hg_source_link = link_to('source:hg1|some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :repository_id => 'hg1', :path => ['some', 'file']}, :class => 'source') | 419 hg_source_link = link_to('source:hg1|some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :repository_id => 'hg1', :path => ['some', 'file']}, :class => 'source') |
411 | 420 |
412 to_test = { | 421 to_test = { |
413 'r2' => changeset_link, | 422 'r2' => changeset_link, |
414 'svn1|r123' => svn_changeset_link, | 423 'svn_repo-1|r123' => svn_changeset_link, |
415 'invalid|r123' => 'invalid|r123', | 424 'invalid|r123' => 'invalid|r123', |
416 'commit:hg1|abcd' => hg_changeset_link, | 425 'commit:hg1|abcd' => hg_changeset_link, |
417 'commit:invalid|abcd' => 'commit:invalid|abcd', | 426 'commit:invalid|abcd' => 'commit:invalid|abcd', |
418 # source | 427 # source |
419 'source:some/file' => source_link, | 428 'source:some/file' => source_link, |
547 attachment_link = link_to('error281.txt', {:controller => 'attachments', :action => 'download', :id => '1'}, :class => 'attachment') | 556 attachment_link = link_to('error281.txt', {:controller => 'attachments', :action => 'download', :id => '1'}, :class => 'attachment') |
548 to_test = { | 557 to_test = { |
549 'attachment:error281.txt' => attachment_link | 558 'attachment:error281.txt' => attachment_link |
550 } | 559 } |
551 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => Issue.find(3).attachments), "#{text} failed" } | 560 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => Issue.find(3).attachments), "#{text} failed" } |
561 end | |
562 | |
563 def test_attachment_link_should_link_to_latest_attachment | |
564 set_tmp_attachments_directory | |
565 a1 = Attachment.generate!(:filename => "test.txt", :created_on => 1.hour.ago) | |
566 a2 = Attachment.generate!(:filename => "test.txt") | |
567 | |
568 assert_equal %(<p><a href="/attachments/download/#{a2.id}" class="attachment">test.txt</a></p>), | |
569 textilizable('attachment:test.txt', :attachments => [a1, a2]) | |
552 end | 570 end |
553 | 571 |
554 def test_wiki_links | 572 def test_wiki_links |
555 to_test = { | 573 to_test = { |
556 '[[CookBook documentation]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation" class="wiki-page">CookBook documentation</a>', | 574 '[[CookBook documentation]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation" class="wiki-page">CookBook documentation</a>', |