]> source.dussan.org Git - redmine.git/commitdiff
scm: fix git and mercurial branch list box action
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 2 May 2012 13:19:16 +0000 (13:19 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 2 May 2012 13:19:16 +0000 (13:19 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9612 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb
test/unit/helpers/application_helper_test.rb

index 7e528eb1abf8703d590c44574fe0eb1ae3555fa1..a57157c2937025a9edbdc9cbae2a7fc200438d16 100644 (file)
@@ -369,7 +369,8 @@ module ApplicationHelper
   end
 
   def to_path_param(path)
-    path.to_s.split(%r{[/\\]}).select {|p| !p.blank?}
+    str = path.to_s.split(%r{[/\\]}).select{|p| !p.blank?}.join("/")
+    str.blank? ? nil : str
   end
 
   def pagination_links_full(paginator, count=nil, options={})
index 6dea2cf57f74fdbcdade9fbc47d22b8b3293481f..1a9d4642a636c96089199f8a6b9af23e99a341ca 100644 (file)
@@ -725,6 +725,13 @@ EXPECTED
     assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
   end
 
+  def test_to_path_param
+    assert_equal 'test1/test2', to_path_param('test1/test2')
+    assert_equal 'test1/test2', to_path_param('/test1/test2/')
+    assert_equal 'test1/test2', to_path_param('//test1/test2/')
+    assert_equal nil, to_path_param('/')
+  end
+
   def test_wiki_links_in_tables
     to_test = {"|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|" =>
                  '<tr><td><a href="/projects/ecookbook/wiki/Page" class="wiki-page new">Link title</a></td>' +