##// END OF EJS Templates
add test to destroy at unit attachment test....
Toshi MARUYAMA -
r6642:f28500f1aca4
parent child
Show More
@@ -39,6 +39,23 class AttachmentTest < ActiveSupport::TestCase
39 assert_equal 59, File.size(a.diskfile)
39 assert_equal 59, File.size(a.diskfile)
40 end
40 end
41
41
42 def test_destroy
43 a = Attachment.new(:container => Issue.find(1),
44 :file => uploaded_test_file("testfile.txt", "text/plain"),
45 :author => User.find(1))
46 assert a.save
47 assert_equal 'testfile.txt', a.filename
48 assert_equal 59, a.filesize
49 assert_equal 'text/plain', a.content_type
50 assert_equal 0, a.downloads
51 assert_equal '1478adae0d4eb06d35897518540e25d6', a.digest
52 diskfile = a.diskfile
53 assert File.exist?(diskfile)
54 assert_equal 59, File.size(a.diskfile)
55 assert a.destroy
56 assert !File.exist?(diskfile)
57 end
58
42 def test_create_should_auto_assign_content_type
59 def test_create_should_auto_assign_content_type
43 a = Attachment.new(:container => Issue.find(1),
60 a = Attachment.new(:container => Issue.find(1),
44 :file => uploaded_test_file("testfile.txt", ""),
61 :file => uploaded_test_file("testfile.txt", ""),
General Comments 0
You need to be logged in to leave comments. Login now