|
|
@@ -81,6 +81,19 @@ class AttachmentTest < ActiveSupport::TestCase |
|
|
|
assert_nil a.content_type |
|
|
|
end |
|
|
|
|
|
|
|
def test_shorted_filename_if_too_long |
|
|
|
file = uploaded_test_file("testfile.txt", "text/plain") |
|
|
|
file.instance_variable_set('@original_filename', "#{'a'*251}.txt") |
|
|
|
assert 255, file.original_filename.length |
|
|
|
|
|
|
|
a = Attachment.new(:container => Issue.find(1), |
|
|
|
:file => file, |
|
|
|
:author => User.find(1)) |
|
|
|
assert a.save |
|
|
|
a.reload |
|
|
|
assert_equal 12 + 1 + 32 + 4, a.disk_filename.length |
|
|
|
end |
|
|
|
|
|
|
|
def test_copy_should_preserve_attributes |
|
|
|
a = Attachment.find(1) |
|
|
|
copy = a.copy |