From 8827f61b709815a2d79cd6dcf12aca754be79498 Mon Sep 17 00:00:00 2001 From: Alexey Verkhovsky Date: Tue, 3 May 2005 02:13:42 +0000 Subject: [PATCH] Export with no layout option in the export_html --- app/controllers/wiki_controller.rb | 2 +- test/functional/wiki_controller_test.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 01d5780d..a8ce9c66 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -49,7 +49,7 @@ class WikiController < ApplicationController export_pages_as_zip('html') do |page| @page = page @link_mode = :export - render_to_string('wiki/print', use_layout = true) + render_to_string('wiki/print', use_layout = (@params['layout'] != 'no')) end end diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 8e5bb847..cb844d46 100755 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -117,6 +117,20 @@ class WikiControllerTest < Test::Unit::TestCase assert_equal :export, r.template_objects['link_mode'] end + def test_export_html_no_layout + setup_wiki_with_three_pages + + r = process 'export_html', 'web' => 'wiki1', 'layout' => 'no' + + assert_success + assert_equal 'application/zip', r.headers['Content-Type'] + assert_match /attachment; filename="wiki1-html-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/, + r.headers['Content-Disposition'] + content = r.binary_content + assert_equal 'PK', content[0..1], 'Content is not a zip file' + assert_equal :export, r.template_objects['link_mode'] + end + def test_export_markup r = process 'export_markup', 'web' => 'wiki1'