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
This commit is contained in:
Jean-Philippe Lang
2012-01-20 17:56:28 +00:00
parent e347fba11a
commit 8a3623733f
5 changed files with 110 additions and 4 deletions
+12
View File
@@ -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?