summaryrefslogtreecommitdiffstats
path: root/test/unit/document_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-26 20:12:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-26 20:12:20 +0000
commit43fd27fd0ce4111501c36a6ef162aed61bf3318c (patch)
tree6a805a37c06baaba9a1c2935f32b22e6bca2cafb /test/unit/document_test.rb
parentf3bcb705f74622afae785d9df793a0bbed3a11d3 (diff)
downloadredmine-43fd27fd0ce4111501c36a6ef162aed61bf3318c.tar.gz
redmine-43fd27fd0ce4111501c36a6ef162aed61bf3318c.zip
Show last update datetime (last attachment added) on document list (#4232).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3095 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/document_test.rb')
-rw-r--r--test/unit/document_test.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/unit/document_test.rb b/test/unit/document_test.rb
index 02ae94dd0..9e76311bd 100644
--- a/test/unit/document_test.rb
+++ b/test/unit/document_test.rb
@@ -18,7 +18,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class DocumentTest < ActiveSupport::TestCase
- fixtures :projects, :enumerations, :documents
+ fixtures :projects, :enumerations, :documents, :attachments
def test_create
doc = Document.new(:project => Project.find(1), :title => 'New document', :category => Enumeration.find_by_name('User documentation'))
@@ -43,4 +43,16 @@ class DocumentTest < ActiveSupport::TestCase
assert_equal e, doc.category
assert doc.save
end
+
+ def test_updated_on_with_attachments
+ d = Document.find(1)
+ assert d.attachments.any?
+ assert_equal d.attachments.map(&:created_on).max, d.updated_on
+ end
+
+ def test_updated_on_without_attachments
+ d = Document.find(2)
+ assert d.attachments.empty?
+ assert_equal d.created_on, d.updated_on
+ end
end