diff options
author | Go MAEDA <maeda@farend.jp> | 2019-10-04 11:17:33 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-10-04 11:17:33 +0000 |
commit | 5ce4a363a951e4a64afd29bbe216b83fe4fdcc12 (patch) | |
tree | 33f3e2c8f59467f435f7a0f960b21d58eff87d73 /test/unit | |
parent | b83402029721fd5813e3ae6c1eea5fc644651ebf (diff) | |
download | redmine-5ce4a363a951e4a64afd29bbe216b83fe4fdcc12.tar.gz redmine-5ce4a363a951e4a64afd29bbe216b83fe4fdcc12.zip |
Fix test failure due to missing call to set_tmp_attachments_directory (#32122).
Patch by Yuichi HARADA.
git-svn-id: http://svn.redmine.org/redmine/trunk@18593 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/attachment_test.rb | 10 | ||||
-rw-r--r-- | test/unit/board_test.rb | 1 | ||||
-rw-r--r-- | test/unit/lib/redmine/export/pdf_test.rb | 7 | ||||
-rw-r--r-- | test/unit/mail_handler_test.rb | 7 | ||||
-rw-r--r-- | test/unit/message_test.rb | 1 | ||||
-rw-r--r-- | test/unit/project_copy_test.rb | 4 | ||||
-rw-r--r-- | test/unit/user_test.rb | 1 | ||||
-rw-r--r-- | test/unit/wiki_page_test.rb | 1 | ||||
-rw-r--r-- | test/unit/wiki_test.rb | 2 |
9 files changed, 29 insertions, 5 deletions
diff --git a/test/unit/attachment_test.rb b/test/unit/attachment_test.rb index 2605f03f0..fbbe71fbe 100644 --- a/test/unit/attachment_test.rb +++ b/test/unit/attachment_test.rb @@ -344,6 +344,8 @@ class AttachmentTest < ActiveSupport::TestCase assert attachment.readable? attachment.update_digest_to_sha256! assert_equal 'ac5c6e99a21ae74b2e3f5b8e5b568be1b9107cd7153d139e822b9fe5caf50938', attachment.digest + ensure + set_tmp_attachments_directory end def test_update_attachments @@ -403,7 +405,7 @@ class AttachmentTest < ActiveSupport::TestCase assert_equal 17, la1.id la2 = Attachment.latest_attach([a1, a2], "Testfile.PNG") assert_equal 17, la2.id - + ensure set_tmp_attachments_directory end @@ -444,6 +446,8 @@ class AttachmentTest < ActiveSupport::TestCase assert File.exist?(thumbnail) end end + ensure + set_tmp_attachments_directory end def test_should_reuse_thumbnail @@ -490,6 +494,8 @@ class AttachmentTest < ActiveSupport::TestCase set_fixtures_attachments_directory attachment = Attachment.find(16) assert_nil attachment.thumbnail + ensure + set_tmp_attachments_directory end def test_thumbnail_should_be_at_least_of_requested_size @@ -508,6 +514,8 @@ class AttachmentTest < ActiveSupport::TestCase assert_equal "8e0294de2441577c529f170b6fb8f638_2654_#{generated_size}.thumb", File.basename(thumbnail) end + ensure + set_tmp_attachments_directory end else puts '(ImageMagick convert not available)' diff --git a/test/unit/board_test.rb b/test/unit/board_test.rb index 3f7679320..52cc37779 100644 --- a/test/unit/board_test.rb +++ b/test/unit/board_test.rb @@ -93,6 +93,7 @@ class BoardTest < ActiveSupport::TestCase end def test_destroy + set_tmp_attachments_directory board = Board.find(1) assert_difference 'Message.count', -6 do assert_difference 'Attachment.count', -1 do diff --git a/test/unit/lib/redmine/export/pdf_test.rb b/test/unit/lib/redmine/export/pdf_test.rb index 095dcfb55..3bad1d8d9 100644 --- a/test/unit/lib/redmine/export/pdf_test.rb +++ b/test/unit/lib/redmine/export/pdf_test.rb @@ -69,9 +69,8 @@ class PdfTest < ActiveSupport::TestCase end def test_attach + set_fixtures_attachments_directory ["CP932", "SJIS"].each do |encoding| - set_fixtures_attachments_directory - str2 = "\x83e\x83X\x83g".b a1 = Attachment.find(17) @@ -99,8 +98,8 @@ class PdfTest < ActiveSupport::TestCase assert_nil aa1 aa2 = Redmine::Export::PDF::RDMPdfEncoding::attach(Attachment.all, "test#{str2}.png", encoding) assert_nil aa2 - - set_tmp_attachments_directory end + ensure + set_tmp_attachments_directory end end diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb index 51a07aeec..e3c527fa1 100644 --- a/test/unit/mail_handler_test.rb +++ b/test/unit/mail_handler_test.rb @@ -543,6 +543,7 @@ class MailHandlerTest < ActiveSupport::TestCase end def test_add_issue_from_apple_mail + set_tmp_attachments_directory issue = submit_email( 'apple_mail_with_attachment.eml', :issue => {:project => 'ecookbook'} @@ -559,6 +560,7 @@ class MailHandlerTest < ActiveSupport::TestCase end def test_thunderbird_with_attachment_ja + set_tmp_attachments_directory issue = submit_email( 'thunderbird_with_attachment_ja.eml', :issue => {:project => 'ecookbook'} @@ -583,6 +585,7 @@ class MailHandlerTest < ActiveSupport::TestCase end def test_gmail_with_attachment_ja + set_tmp_attachments_directory issue = submit_email( 'gmail_with_attachment_ja.eml', :issue => {:project => 'ecookbook'} @@ -598,6 +601,7 @@ class MailHandlerTest < ActiveSupport::TestCase end def test_thunderbird_with_attachment_latin1 + set_tmp_attachments_directory issue = submit_email( 'thunderbird_with_attachment_iso-8859-1.eml', :issue => {:project => 'ecookbook'} @@ -616,6 +620,7 @@ class MailHandlerTest < ActiveSupport::TestCase end def test_gmail_with_attachment_latin1 + set_tmp_attachments_directory issue = submit_email( 'gmail_with_attachment_iso-8859-1.eml', :issue => {:project => 'ecookbook'} @@ -634,6 +639,7 @@ class MailHandlerTest < ActiveSupport::TestCase end def test_mail_with_attachment_latin2 + set_tmp_attachments_directory issue = submit_email( 'ticket_with_text_attachment_iso-8859-2.eml', :issue => {:project => 'ecookbook'} @@ -987,6 +993,7 @@ class MailHandlerTest < ActiveSupport::TestCase end def test_reply_to_a_nonexistent_issue + set_tmp_attachments_directory Issue.find(2).destroy assert_no_difference 'Issue.count' do assert_no_difference 'Journal.count' do diff --git a/test/unit/message_test.rb b/test/unit/message_test.rb index 5bbb2190c..e714e09ae 100644 --- a/test/unit/message_test.rb +++ b/test/unit/message_test.rb @@ -108,6 +108,7 @@ class MessageTest < ActiveSupport::TestCase end def test_destroy_topic + set_tmp_attachments_directory message = Message.find(1) board = message.board topics_count, messages_count = board.topics_count, board.messages_count diff --git a/test/unit/project_copy_test.rb b/test/unit/project_copy_test.rb index af56c15a9..e121dcc16 100644 --- a/test/unit/project_copy_test.rb +++ b/test/unit/project_copy_test.rb @@ -55,6 +55,7 @@ class ProjectCopyTest < ActiveSupport::TestCase end test "#copy should copy project attachments" do + set_tmp_attachments_directory Attachment.create!(:container => @source_project, :file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 1) assert @project.copy(@source_project) @@ -207,6 +208,7 @@ class ProjectCopyTest < ActiveSupport::TestCase end test "#copy should copy issue attachments" do + set_tmp_attachments_directory issue = Issue.generate!(:subject => "copy with attachment", :tracker_id => 1, :project_id => @source_project.id) Attachment.create!(:container => issue, :file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 1) @source_project.issues << issue @@ -296,6 +298,7 @@ class ProjectCopyTest < ActiveSupport::TestCase end test "#copy should copy version attachments" do + set_tmp_attachments_directory version = Version.generate!(:name => "copy with attachment") Attachment.create!(:container => version, :file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 1) @source_project.versions << version @@ -378,6 +381,7 @@ class ProjectCopyTest < ActiveSupport::TestCase end test "#copy should copy document attachments" do + set_tmp_attachments_directory document = Document.generate!(:title => "copy with attachment", :category_id => 1, :project_id => @source_project.id) Attachment.create!(:container => document, :file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 1) @source_project.documents << document diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 519de8b04..da9fbe7ed 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -262,6 +262,7 @@ class UserTest < ActiveSupport::TestCase end def test_destroy_should_update_attachments + set_tmp_attachments_directory attachment = Attachment.create!(:container => Project.find(1), :file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 2) diff --git a/test/unit/wiki_page_test.rb b/test/unit/wiki_page_test.rb index f3fe4fbbd..6092e3fd5 100644 --- a/test/unit/wiki_page_test.rb +++ b/test/unit/wiki_page_test.rb @@ -143,6 +143,7 @@ class WikiPageTest < ActiveSupport::TestCase end def test_destroy_should_delete_content_and_its_versions + set_tmp_attachments_directory page = WikiPage.find(1) assert_difference 'WikiPage.count', -1 do assert_difference 'WikiContent.count', -1 do diff --git a/test/unit/wiki_test.rb b/test/unit/wiki_test.rb index b4ecd29bb..d4688569d 100644 --- a/test/unit/wiki_test.rb +++ b/test/unit/wiki_test.rb @@ -103,6 +103,7 @@ class WikiTest < ActiveSupport::TestCase end def test_destroy_should_remove_redirects_from_the_wiki + set_tmp_attachments_directory WikiRedirect.create!(:wiki_id => 1, :title => 'Foo', :redirects_to_wiki_id => 2, :redirects_to => 'Bar') Wiki.find(1).destroy @@ -110,6 +111,7 @@ class WikiTest < ActiveSupport::TestCase end def test_destroy_should_remove_redirects_to_the_wiki + set_tmp_attachments_directory WikiRedirect.create!(:wiki_id => 2, :title => 'Foo', :redirects_to_wiki_id => 1, :redirects_to => 'Bar') Wiki.find(1).destroy |