summaryrefslogtreecommitdiffstats
path: root/test/unit/project_copy_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-09-20 12:50:06 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-09-20 12:50:06 +0000
commita28bf20c4ca2c422aceed602c398adf3aa85f92c (patch)
tree164efc4e672ab1b7dc7249a78b63bbb91696ec54 /test/unit/project_copy_test.rb
parenteb57fa4847dab2bdc0026ef86ad6ade0f8a5b1cf (diff)
downloadredmine-a28bf20c4ca2c422aceed602c398adf3aa85f92c.tar.gz
redmine-a28bf20c4ca2c422aceed602c398adf3aa85f92c.zip
Project copy does not update custom field of version type values (#20361).
git-svn-id: http://svn.redmine.org/redmine/trunk@14615 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_copy_test.rb')
-rw-r--r--test/unit/project_copy_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/unit/project_copy_test.rb b/test/unit/project_copy_test.rb
index d375d8fbc..537e39385 100644
--- a/test/unit/project_copy_test.rb
+++ b/test/unit/project_copy_test.rb
@@ -139,6 +139,27 @@ class ProjectCopyTest < ActiveSupport::TestCase
assert_equal assigned_version, copied_issue.fixed_version
end
+ def test_copy_issues_should_reassign_version_custom_fields_to_copied_versions
+ User.current = User.find(1)
+ CustomField.delete_all
+ field = IssueCustomField.generate!(:field_format => 'version', :is_for_all => true, :trackers => Tracker.all)
+ source_project = Project.generate!(:trackers => Tracker.all)
+ source_version = Version.generate!(:project => source_project)
+ source_issue = Issue.generate!(:project => source_project) do |issue|
+ issue.custom_field_values = {field.id.to_s => source_version.id.to_s}
+ end
+ assert_equal source_version.id.to_s, source_issue.custom_field_value(field)
+
+ project = Project.new(:name => 'Copy Test', :identifier => 'copy-test', :trackers => Tracker.all)
+ assert project.copy(source_project)
+ assert_equal 1, project.issues.count
+ issue = project.issues.first
+ assert_equal 1, project.versions.count
+ version = project.versions.first
+
+ assert_equal version.id.to_s, issue.custom_field_value(field)
+ end
+
test "#copy should copy issue relations" do
Setting.cross_project_issue_relations = '1'