From 43d214350643d6867d1b0969fe14bc034f139cbd Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Thu, 10 May 2012 08:55:56 -0400 Subject: [PATCH] Redirect from root to /Home, fixes #250 --- lib/gollum/frontend/app.rb | 2 +- test/test_app.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/gollum/frontend/app.rb b/lib/gollum/frontend/app.rb index 94352f49..0e05765d 100644 --- a/lib/gollum/frontend/app.rb +++ b/lib/gollum/frontend/app.rb @@ -39,7 +39,7 @@ module Precious end get '/' do - show_page_or_file('Home') + redirect File.join(settings.wiki_options[:base_path].to_s, 'Home') end get '/edit/*' do diff --git a/test/test_app.rb b/test/test_app.rb index f83f9922..988bc146 100644 --- a/test/test_app.rb +++ b/test/test_app.rb @@ -167,6 +167,20 @@ context "Frontend" do assert_equal page1.version.sha, page2.version.sha end + test "redirects from 'base_path' or 'base_path/' to 'base_path/Home'" do + Precious::App.set(:wiki_options, {}) + get "/" + assert_match "http://example.org/Home", last_response.headers['Location'] + + Precious::App.set(:wiki_options, { :base_path => '/wiki' }) + get "/" + assert_match "http://example.org/wiki/Home", last_response.headers['Location'] + + Precious::App.set(:wiki_options, { :base_path => '/wiki/' }) + get "/" + assert_match "http://example.org/wiki/Home", last_response.headers['Location'] + end + def app Precious::App end