From 51b5a11a54e799bf8d7b2911e651cc7e7b440c21 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Thu, 20 Aug 2015 23:19:25 -0400 Subject: [PATCH] Fix custom.x path when page-file-dir is not set --- lib/gollum/views/layout.rb | 2 +- test/test_app.rb | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/gollum/views/layout.rb b/lib/gollum/views/layout.rb index d6de7393..e2d14166 100644 --- a/lib/gollum/views/layout.rb +++ b/lib/gollum/views/layout.rb @@ -29,7 +29,7 @@ module Precious end def custom_path - "#{@base_url}#{@page_dir.nil? ? '' : '/'}#{@page_dir}" + "#{@base_url}#{@page_dir.empty? ? '' : '/'}#{@page_dir}" end def css # custom css diff --git a/test/test_app.rb b/test/test_app.rb index 454d4de3..6f1b7294 100644 --- a/test/test_app.rb +++ b/test/test_app.rb @@ -513,10 +513,23 @@ context "Frontend" do { :name => 'user1', :email => 'user1' }); get page - assert_match /custom.js/, last_response.body + assert_match /"\/custom.js"/, last_response.body Precious::App.set(:wiki_options, { :js => nil }) end + test "change custom.css path if page-file-dir is set" do + Precious::App.set(:wiki_options, { :css => true, :page_file_dir => 'docs'}) + page = 'docs/yaycustom' + text = 'customized!' + + @wiki.write_page(page, :markdown, text, + { :name => 'user1', :email => 'user1' }); + + get page + assert_match /"\/docs\/custom.css"/, last_response.body + Precious::App.set(:wiki_options, { :css => nil, :page_file_dir => nil }) + end + test "show edit page with header and footer and sidebar of multibyte" do post "/create", :content => 'りんご',