summaryrefslogtreecommitdiffstats
path: root/test/unit/helpers
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-01-11 11:06:56 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-01-11 11:06:56 +0000
commit6a6b68d29515cea7c83a8651cfc9b5d7490a6f4c (patch)
treec82725fd37d82ea7ce6e4a9ca2ddb4c8bd48a3f2 /test/unit/helpers
parent80b329d031dc29791f850e979d58cba872e1154b (diff)
downloadredmine-6a6b68d29515cea7c83a8651cfc9b5d7490a6f4c.tar.gz
redmine-6a6b68d29515cea7c83a8651cfc9b5d7490a6f4c.zip
scm: add compatible "commit:xxx" link test for git and darcs.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4690 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/helpers')
-rw-r--r--test/unit/helpers/application_helper_test.rb51
1 files changed, 49 insertions, 2 deletions
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
index 52d49743d..0f638cbd0 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -147,7 +147,7 @@ RAW
}
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
end
-
+
def test_redmine_links
issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3},
:class => 'issue status-1 priority-1 overdue', :title => 'Error 281 when updating a recipe (New)')
@@ -224,7 +224,54 @@ RAW
@project = Project.find(1)
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text), "#{text} failed" }
end
-
+
+ def test_redmine_links_git_commit
+ changeset_link = link_to('abcd',
+ {
+ :controller => 'repositories',
+ :action => 'revision', :id => 'subproject1',
+ :rev => 'abcd'
+ },
+ :class => 'changeset', :title => 'test commit')
+ to_test = {
+ 'commit:abcd' => changeset_link,
+ }
+ @project = Project.find(3)
+ r = Repository::Git.create!(:project => @project, :url => '/tmp/test/git')
+ assert r
+ c = Changeset.new(:repository => r,
+ :committed_on => Time.now,
+ :revision => 'abcd',
+ :scmid => 'abcd',
+ :comments => 'test commit')
+ assert( c.save )
+ to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
+ end
+
+ # TODO: Bazaar commit id contains mail address, so it contains '@' and '_'.
+ def test_redmine_links_darcs_commit
+ changeset_link = link_to('20080308225258-98289-abcd456efg.gz',
+ {
+ :controller => 'repositories',
+ :action => 'revision', :id => 'subproject1',
+ :rev => '123'
+ },
+ :class => 'changeset', :title => 'test commit')
+ to_test = {
+ 'commit:20080308225258-98289-abcd456efg.gz' => changeset_link,
+ }
+ @project = Project.find(3)
+ r = Repository::Darcs.create!(:project => @project, :url => '/tmp/test/darcs')
+ assert r
+ c = Changeset.new(:repository => r,
+ :committed_on => Time.now,
+ :revision => '123',
+ :scmid => '20080308225258-98289-abcd456efg.gz',
+ :comments => 'test commit')
+ assert( c.save )
+ to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
+ end
+
def test_attachment_links
attachment_link = link_to('error281.txt', {:controller => 'attachments', :action => 'download', :id => '1'}, :class => 'attachment')
to_test = {