/wiki/published renders a home page

This commit is contained in:
Alexey Verkhovsky 2006-05-04 04:45:05 +00:00
parent cbca2ba318
commit 709d28dc4b
2 changed files with 13 additions and 4 deletions

View file

@ -205,11 +205,11 @@ class WikiController < ApplicationController
return return
end end
page_name = @page_name || 'HomePage' @page_name ||= 'HomePage'
page = wiki.read_page(@web_name, page_name) @page ||= wiki.read_page(@web_name, @page_name)
render(:text => "Page '#{page_name}' not found", :status => 404) and return unless page render(:text => "Page '#{@page_name}' not found", :status => 404) and return unless @page
@renderer = PageRenderer.new(page.revisions.last) @renderer = PageRenderer.new(@page.revisions.last)
end end
def revision def revision

View file

@ -293,6 +293,15 @@ class WikiControllerTest < Test::Unit::TestCase
assert_response :missing assert_response :missing
end end
def test_published_should_render_homepage_if_no_page_specified
set_web_property :published, true
r = process('published', 'web' => 'wiki1')
assert_success
assert_equal @home, r.template_objects['page']
end
def test_recently_revised def test_recently_revised
r = process('recently_revised', 'web' => 'wiki1') r = process('recently_revised', 'web' => 'wiki1')