Add tests for base_path (#1540)

This commit is contained in:
Dawa Ometto
2020-04-03 17:12:09 +02:00
committed by GitHub
parent ff1baf0036
commit 676811206d
3 changed files with 68 additions and 23 deletions
+24
View File
@@ -40,6 +40,30 @@ Gollum::set_git_max_filesize(190 * 10**6)
# See the wiki.rb file for more details on wiki options
module Precious
# For use with the --base-path option.
class MapGollum
def initialize(base_path)
@mg = Rack::Builder.new do
map "/#{base_path}" do
run Precious::App
end
map '/' do
run Proc.new { [302, { 'Location' => "/#{base_path}" }, []] }
end
map '/*' do
run Proc.new { [302, { 'Location' => "/#{base_path}" }, []] }
end
end
end
def call(env)
@mg.call(env)
end
end
class App < Sinatra::Base
register Mustache::Sinatra
register Sinatra::Namespace