From 424a70978ed71bb7ef6fbf6093d66ac67772651b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Thu, 19 Apr 2012 07:58:02 +0000 Subject: [PATCH] Additional tests for the PDF export of an issue. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9445 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/issues_controller_test.rb | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index e039468c2..adb7ebf2f 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -1169,6 +1169,42 @@ class IssuesControllerTest < ActionController::TestCase assert_not_nil assigns(:issue) end + def test_show_export_to_pdf_with_ancestors + issue = Issue.generate!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'child', :parent_issue_id => 1) + + get :show, :id => issue.id, :format => 'pdf' + assert_response :success + assert_equal 'application/pdf', @response.content_type + assert @response.body.starts_with?('%PDF') + end + + def test_show_export_to_pdf_with_descendants + c1 = Issue.generate!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'child', :parent_issue_id => 1) + c2 = Issue.generate!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'child', :parent_issue_id => 1) + c3 = Issue.generate!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'child', :parent_issue_id => c1.id) + + get :show, :id => 1, :format => 'pdf' + assert_response :success + assert_equal 'application/pdf', @response.content_type + assert @response.body.starts_with?('%PDF') + end + + def test_show_export_to_pdf_with_journals + get :show, :id => 1, :format => 'pdf' + assert_response :success + assert_equal 'application/pdf', @response.content_type + assert @response.body.starts_with?('%PDF') + end + + def test_show_export_to_pdf_with_changesets + Issue.find(3).changesets = Changeset.find_all_by_id(100, 101, 102) + + get :show, :id => 3, :format => 'pdf' + assert_response :success + assert_equal 'application/pdf', @response.content_type + assert @response.body.starts_with?('%PDF') + end + def test_get_new @request.session[:user_id] = 2 get :new, :project_id => 1, :tracker_id => 1 -- 2.39.5