diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-16 21:18:01 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-16 21:18:01 +0000 |
commit | b455ac2a27aefccdf10c9f3a1727e1edb8b41ae1 (patch) | |
tree | 33f65ff98b2a28da04cfef1eb43144e58fe713b8 /test/unit/attachment_test.rb | |
parent | 4c090e869ea3248df17264edcc6d9a1e42ffd707 (diff) | |
download | redmine-b455ac2a27aefccdf10c9f3a1727e1edb8b41ae1.tar.gz redmine-b455ac2a27aefccdf10c9f3a1727e1edb8b41ae1.zip |
Adds a rake test that removes old unattached uploads (#10253).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8893 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/attachment_test.rb')
-rw-r--r-- | test/unit/attachment_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/unit/attachment_test.rb b/test/unit/attachment_test.rb index fb68ab655..ecee774a6 100644 --- a/test/unit/attachment_test.rb +++ b/test/unit/attachment_test.rb @@ -144,6 +144,16 @@ class AttachmentTest < ActiveSupport::TestCase assert_equal 'cbb5b0f30978ba03731d61f9f6d10011', Attachment.disk_filename("test_accentué.ça")[13..-1] end + def test_prune_should_destroy_old_unattached_attachments + Attachment.create!(:file => uploaded_test_file("testfile.txt", ""), :author_id => 1, :created_on => 2.days.ago) + Attachment.create!(:file => uploaded_test_file("testfile.txt", ""), :author_id => 1, :created_on => 2.days.ago) + Attachment.create!(:file => uploaded_test_file("testfile.txt", ""), :author_id => 1) + + assert_difference 'Attachment.count', -2 do + Attachment.prune + end + end + context "Attachmnet.attach_files" do should "attach the file" do issue = Issue.first |