diff options
author | Go MAEDA <maeda@farend.jp> | 2021-11-22 08:42:44 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2021-11-22 08:42:44 +0000 |
commit | 0a5ef25e87f7896a70bfd86302e6e8995b518f98 (patch) | |
tree | 95264ef633eb0c0505c46bbfe68f886dd7d4e5a3 /test/unit/journal_test.rb | |
parent | d72ae9b32b7bef20eb1f2f291d54f3ad4297994e (diff) | |
download | redmine-0a5ef25e87f7896a70bfd86302e6e8995b518f98.tar.gz redmine-0a5ef25e87f7896a70bfd86302e6e8995b518f98.zip |
Download all attachments in a journal (#35462).
Patch by Takenori TAKAKI.
git-svn-id: http://svn.redmine.org/redmine/trunk@21292 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/journal_test.rb')
-rw-r--r-- | test/unit/journal_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/journal_test.rb b/test/unit/journal_test.rb index 096240734..345d64aba 100644 --- a/test/unit/journal_test.rb +++ b/test/unit/journal_test.rb @@ -222,4 +222,18 @@ class JournalTest < ActiveSupport::TestCase visible_details = journal.visible_details(User.find(2)) assert_equal 2, visible_details.size end + + def test_attachments + journal = Journal.new + [0, 1].map{ |i| Attachment.generate!(:file => mock_file_with_options(:original_filename => "image#{i}.png")) }.each do |attachment| + journal.details << JournalDetail.new(:property => 'attachment', :prop_key => attachment.id, :value => attachment.filename) + end + + attachments = journal.attachments + assert_equal 2, attachments.size + attachments.each_with_index do |attachment, i| + assert_kind_of Attachment, attachment + assert_equal "image#{i}.png", attachment.filename + end + end end |