# ~*~ encoding: utf-8 ~*~ require File.expand_path(File.join(File.dirname(__FILE__), "helper")) context "Frontend" do include Rack::Test::Methods setup do @path = cloned_testpath("examples/revert.git") @wiki = Gollum::Wiki.new(@path) Precious::App.set(:gollum_path, @path) Precious::App.set(:wiki_options, {}) end teardown 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 "utf-8 kcode" do assert_equal 'μ†ℱ'.scan(/./), ["μ", "†", "ℱ"] end test "UTF-8 headers href preserved" do page = 'utfh1' text = '한글' # don't use h1 or it will be promoted to replace file name # which doesn't generate a normal header link @wiki.write_page(page, :markdown, '## ' + text, { :name => 'user1', :email => 'user1' }); get page assert_match /