1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-01 21:29:40 +00:00

Adds a test for when the file comparison fails (#25215).

git-svn-id: http://svn.redmine.org/redmine/trunk@16462 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2017-04-03 12:51:13 +00:00
parent 1b81a030ce
commit 2660a2e5b3

View File

@ -221,6 +221,15 @@ class AttachmentTest < ActiveSupport::TestCase
assert_equal a1.diskfile, a2.diskfile
end
def test_attachments_with_same_content_should_not_reuse_same_file_if_deleted
a1 = Attachment.create!(:container => Issue.find(1), :author => User.find(1),
:file => mock_file(:filename => 'foo', :content => 'abcd'))
a1.delete_from_disk
a2 = Attachment.create!(:container => Issue.find(1), :author => User.find(1),
:file => mock_file(:filename => 'bar', :content => 'abcd'))
assert_not_equal a1.diskfile, a2.diskfile
end
def test_attachments_with_same_filename_at_the_same_time_should_not_overwrite
a1 = Attachment.create!(:container => Issue.find(1), :author => User.find(1),
:file => mock_file(:filename => 'foo', :content => 'abcd'))