summaryrefslogtreecommitdiffstats
path: root/test/unit/attachment_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-16 16:42:23 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-16 16:42:23 +0000
commit5c2de4dfc95293a7965ff8cf980a310922fc4c05 (patch)
tree216137d4546e967ca7f4ce7fee328ac62ca93830 /test/unit/attachment_test.rb
parent570e1b1d626543738cec3dc3ed07da73a47a98dd (diff)
downloadredmine-5c2de4dfc95293a7965ff8cf980a310922fc4c05.tar.gz
redmine-5c2de4dfc95293a7965ff8cf980a310922fc4c05.zip
Adds Attachment#title.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10012 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/attachment_test.rb')
-rw-r--r--test/unit/attachment_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/unit/attachment_test.rb b/test/unit/attachment_test.rb
index c2a3e56b4..61ff048a7 100644
--- a/test/unit/attachment_test.rb
+++ b/test/unit/attachment_test.rb
@@ -150,6 +150,14 @@ class AttachmentTest < ActiveSupport::TestCase
assert_equal 'cbb5b0f30978ba03731d61f9f6d10011', Attachment.disk_filename("test_accentué.ça")[13..-1]
end
+ def test_title
+ a = Attachment.new(:filename => "test.png")
+ assert_equal "test.png", a.title
+
+ a = Attachment.new(:filename => "test.png", :description => "Cool image")
+ assert_equal "test.png (Cool image)", a.title
+ 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)