Skip to content
This repository has been archived by the owner on Apr 19, 2019. It is now read-only.

Commit

Permalink
Redirect from root to /Home, fixes gollum#250
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Harvey committed May 10, 2012
1 parent a692ec1 commit 43d2143
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/gollum/frontend/app.rb
Expand Up @@ -39,7 +39,7 @@ class App < Sinatra::Base
end

get '/' do
show_page_or_file('Home')
redirect File.join(settings.wiki_options[:base_path].to_s, 'Home')
end

get '/edit/*' do
Expand Down
14 changes: 14 additions & 0 deletions test/test_app.rb
Expand Up @@ -167,6 +167,20 @@
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
Expand Down

0 comments on commit 43d2143

Please sign in to comment.