Redirect from root to /Home, fixes #250

This commit is contained in:
Tim Harvey
2012-05-10 08:55:56 -04:00
parent a692ec1124
commit 43d2143506
2 changed files with 15 additions and 1 deletions
+1 -1
View File
@@ -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
+14
View File
@@ -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