summaryrefslogtreecommitdiffstats
path: root/test/unit/project_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-20 17:56:28 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-20 17:56:28 +0000
commit8a3623733fa2ef879bb2a3f4355e0ce0df49b278 (patch)
treeaabdb9f4aa05eff33a8f19551aa1fa8558ebc813 /test/unit/project_test.rb
parente347fba11aea87a6bdc9ab6aeaca742d13a8c613 (diff)
downloadredmine-8a3623733fa2ef879bb2a3f4355e0ce0df49b278.tar.gz
redmine-8a3623733fa2ef879bb2a3f4355e0ce0df49b278.zip
Copy attachments on issue and project copy (#3055).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8676 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_test.rb')
-rw-r--r--test/unit/project_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb
index 39c0e8ab0..b3fd3de24 100644
--- a/test/unit/project_test.rb
+++ b/test/unit/project_test.rb
@@ -870,6 +870,18 @@ class ProjectTest < ActiveSupport::TestCase
assert_not_equal source_relation_cross_project.id, copied_relation.id
end
+ should "copy issue attachments" do
+ issue = Issue.generate!(:subject => "copy with attachment", :tracker_id => 1, :project_id => @source_project.id)
+ Attachment.create!(:container => issue, :file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 1)
+ @source_project.issues << issue
+ assert @project.copy(@source_project)
+
+ copied_issue = @project.issues.first(:conditions => {:subject => "copy with attachment"})
+ assert_not_nil copied_issue
+ assert_equal 1, copied_issue.attachments.count, "Attachment not copied"
+ assert_equal "testfile.txt", copied_issue.attachments.first.filename
+ end
+
should "copy memberships" do
assert @project.valid?
assert @project.members.empty?