From 709d28dc4b1d1b47fbfad936b5c72739d20bb42e Mon Sep 17 00:00:00 2001 From: Alexey Verkhovsky Date: Thu, 4 May 2006 04:45:05 +0000 Subject: [PATCH] /wiki/published renders a home page --- app/controllers/wiki_controller.rb | 8 ++++---- test/functional/wiki_controller_test.rb | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 18de3aa2..bf5492dd 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -205,11 +205,11 @@ class WikiController < ApplicationController return end - page_name = @page_name || 'HomePage' - page = wiki.read_page(@web_name, page_name) - render(:text => "Page '#{page_name}' not found", :status => 404) and return unless page + @page_name ||= 'HomePage' + @page ||= wiki.read_page(@web_name, @page_name) + 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 def revision diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index cbb11d0b..3edf75b4 100755 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -293,6 +293,15 @@ class WikiControllerTest < Test::Unit::TestCase assert_response :missing 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 r = process('recently_revised', 'web' => 'wiki1')