diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-12-29 13:28:30 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-12-29 13:28:30 +0000 |
commit | ff7eb7b23a6aa86f4bc1a2d73ee0a3a4f1487ba7 (patch) | |
tree | ab6b2c2a4c24576a32bf193dad9cd934e4150a35 /test/unit/attachment_test.rb | |
parent | b7b4e27833b08b07131d724aa4b1a411f2a13aa0 (diff) | |
download | redmine-ff7eb7b23a6aa86f4bc1a2d73ee0a3a4f1487ba7.tar.gz redmine-ff7eb7b23a6aa86f4bc1a2d73ee0a3a4f1487ba7.zip |
Auto-detect attachment content type when blank (#3782).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3258 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/attachment_test.rb')
-rw-r--r-- | test/unit/attachment_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/unit/attachment_test.rb b/test/unit/attachment_test.rb index 7b289d5c8..8c25adb41 100644 --- a/test/unit/attachment_test.rb +++ b/test/unit/attachment_test.rb @@ -38,6 +38,14 @@ class AttachmentTest < ActiveSupport::TestCase assert File.exist?(a.diskfile) end + def test_create_should_auto_assign_content_type + a = Attachment.new(:container => Issue.find(1), + :file => uploaded_test_file("testfile.txt", ""), + :author => User.find(1)) + assert a.save + assert_equal 'text/plain', a.content_type + end + def test_diskfilename assert Attachment.disk_filename("test_file.txt") =~ /^\d{12}_test_file.txt$/ assert_equal 'test_file.txt', Attachment.disk_filename("test_file.txt")[13..-1] |