From 10fa5c7bd248604c168196c6e9029506f22fc056 Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Thu, 29 Nov 2012 16:50:52 -0700 Subject: [PATCH] Upgrade to stringex 1.5 --- gollum.gemspec | 2 +- lib/gollum/frontend/app.rb | 3 +-- test/test_app.rb | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/gollum.gemspec b/gollum.gemspec index 15039c4b..4077570c 100644 --- a/gollum.gemspec +++ b/gollum.gemspec @@ -32,7 +32,7 @@ Gem::Specification.new do |s| s.add_dependency('sanitize', '~> 2.0.3') s.add_dependency('nokogiri', '~> 1.5.5') s.add_dependency('useragent', '~> 0.4.13') - s.add_dependency('stringex', '~> 1.4.0') + s.add_dependency('stringex', '~> 1.5.0') s.add_development_dependency('RedCloth', '~> 4.2.9') s.add_development_dependency('mocha', '~> 0.13.0') diff --git a/lib/gollum/frontend/app.rb b/lib/gollum/frontend/app.rb index 1a405750..8d47b10e 100644 --- a/lib/gollum/frontend/app.rb +++ b/lib/gollum/frontend/app.rb @@ -18,8 +18,7 @@ class String # _Header => header which causes errors def to_url return nil if self.nil? - return self if ['_Header', '_Footer', '_Sidebar'].include? self - upstream_to_url + upstream_to_url :exclude => ['_Header', '_Footer', '_Sidebar'] end end diff --git a/test/test_app.rb b/test/test_app.rb index d4c7cc53..791fde2f 100644 --- a/test/test_app.rb +++ b/test/test_app.rb @@ -15,6 +15,29 @@ context "Frontend" do FileUtils.rm_rf(@path) end + test "urls transform unicode" do + header = '_Header' + footer = '_Footer' + sidebar = '_Sidebar' + + # header, footer, and sidebar must be preserved + # or gollum will not recognize them + assert_equal header, header.to_url + assert_equal footer, footer.to_url + assert_equal sidebar, sidebar.to_url + + # spaces are converted to dashes in URLs + # and in file names saved to disk + # urls are not case sensitive + assert_equal 'title-space', 'Title Space'.to_url + + # ascii only file names prevent UTF8 issues + # when using git repos across operating systems + # as this test demonstrates, translation is not + # great + assert_equal 'm-plus-f', 'μ†ℱ'.to_url + end + test "retain edit information" do page1 = 'page1' user1 = 'user1'