Merge pull request #331 from tjh/home-page-link-issue

Redirect from root to /Home, fixes #250
This commit is contained in:
bootstraponline
2012-08-09 10:41:31 -07:00
2 changed files with 15 additions and 1 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ module Precious
end
get '/' do
show_page_or_file('Home')
redirect File.join(settings.wiki_options[:base_path].to_s, 'Home')
end
# path is set to name if path is nil.
+14
View File
@@ -249,6 +249,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