diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-01-30 18:42:14 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-01-30 18:42:14 +0000 |
commit | 3d27bf5318ef22d5d66e1863a62c3c6c1f203d66 (patch) | |
tree | 41da619407d5a38bd1538434597fc34fdb23d310 /test/functional/wiki_controller_test.rb | |
parent | a03c585a84d3197e0c35617dc78c9e3ca264c56a (diff) | |
download | redmine-3d27bf5318ef22d5d66e1863a62c3c6c1f203d66.tar.gz redmine-3d27bf5318ef22d5d66e1863a62c3c6c1f203d66.zip |
Adds export of all wiki pages to a PDF file (#3463).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8734 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/wiki_controller_test.rb')
-rw-r--r-- | test/functional/wiki_controller_test.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 3665a75fd..59b1a4319 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -618,12 +618,13 @@ class WikiControllerTest < ActionController::TestCase assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'} end - def test_export + def test_export_to_html @request.session[:user_id] = 2 get :export, :project_id => 'ecookbook' assert_response :success assert_not_nil assigns(:pages) + assert assigns(:pages).any? assert_equal "text/html", @response.content_type assert_select "a[name=?]", "CookBook_documentation" @@ -631,7 +632,19 @@ class WikiControllerTest < ActionController::TestCase assert_select "a[name=?]", "Page_with_an_inline_image" end - def test_export_without_permission + def test_export_to_pdf + @request.session[:user_id] = 2 + get :export, :project_id => 'ecookbook', :format => 'pdf' + + assert_response :success + assert_not_nil assigns(:pages) + assert assigns(:pages).any? + assert_equal 'application/pdf', @response.content_type + assert_equal 'attachment; filename="ecookbook.pdf"', @response.headers['Content-Disposition'] + assert @response.body.starts_with?('%PDF') + end + + def test_export_without_permission_should_redirect get :export, :project_id => 'ecookbook' assert_response 302 |