summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-05-13 08:48:10 +0000
committerGo MAEDA <maeda@farend.jp>2018-05-13 08:48:10 +0000
commitc2c2a9c9f7c991565bc7314cecbb0efe43e46449 (patch)
tree8c62a8d140c27434455b286bdccfec5d4787132c /test
parent8ce031ef49495abd455c3b3965895ee0537c0cee (diff)
downloadredmine-c2c2a9c9f7c991565bc7314cecbb0efe43e46449.tar.gz
redmine-c2c2a9c9f7c991565bc7314cecbb0efe43e46449.zip
Copy version attachments (i.e. Files) along with the versions on project copy (#26622).
Patch by Holger Just. git-svn-id: http://svn.redmine.org/redmine/trunk@17332 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/project_copy_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/project_copy_test.rb b/test/unit/project_copy_test.rb
index 56f485c76..9352c0d04 100644
--- a/test/unit/project_copy_test.rb
+++ b/test/unit/project_copy_test.rb
@@ -284,6 +284,18 @@ class ProjectCopyTest < ActiveSupport::TestCase
end
end
+ test "#copy should copy version attachments" do
+ version = Version.generate!(:name => "copy with attachment")
+ Attachment.create!(:container => version, :file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 1)
+ @source_project.versions << version
+ assert @project.copy(@source_project)
+
+ copied_version = @project.versions.where(:name => "copy with attachment").first
+ assert_not_nil copied_version
+ assert_equal 1, copied_version.attachments.count, "Attachment not copied"
+ assert_equal "testfile.txt", copied_version.attachments.first.filename
+ end
+
test "#copy should copy wiki" do
assert_difference 'Wiki.count' do
assert @project.copy(@source_project)