diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2009-12-13 03:37:21 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2009-12-13 03:37:21 +0000 |
commit | 17512e7efdb2ef03cae94a2697a72d79205a9b2b (patch) | |
tree | 9d03abf427e6b0158c8bd58ff43616b5c8a26692 /test/unit/project_test.rb | |
parent | d58762a52dd7410b302532c0bc5d6b0082287a76 (diff) | |
download | redmine-17512e7efdb2ef03cae94a2697a72d79205a9b2b.tar.gz redmine-17512e7efdb2ef03cae94a2697a72d79205a9b2b.zip |
Copy issue relations when copying a project. (#3367)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3164 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_test.rb')
-rw-r--r-- | test/unit/project_test.rb | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb index 748065ae7..40d5b823b 100644 --- a/test/unit/project_test.rb +++ b/test/unit/project_test.rb @@ -587,6 +587,41 @@ class ProjectTest < ActiveSupport::TestCase assert_not_equal assigned_version.id, copied_issue.fixed_version.id # Different record end + should "copy issue relations" do + Setting.cross_project_issue_relations = '1' + + second_issue = Issue.generate!(:status_id => 5, + :subject => "copy issue relation", + :tracker_id => 1, + :assigned_to_id => 2, + :project_id => @source_project.id) + source_relation = IssueRelation.generate!(:issue_from => Issue.find(4), + :issue_to => second_issue, + :relation_type => "relates") + source_relation_cross_project = IssueRelation.generate!(:issue_from => Issue.find(1), + :issue_to => second_issue, + :relation_type => "duplicates") + + assert @project.copy(@source_project) + assert_equal @source_project.issues.count, @project.issues.count + copied_issue = @project.issues.find_by_subject("Issue on project 2") # Was #4 + copied_second_issue = @project.issues.find_by_subject("copy issue relation") + + # First issue with a relation on project + assert_equal 1, copied_issue.relations.size, "Relation not copied" + copied_relation = copied_issue.relations.first + assert_equal "relates", copied_relation.relation_type + assert_equal copied_second_issue.id, copied_relation.issue_to_id + assert_not_equal source_relation.id, copied_relation.id + + # Second issue with a cross project relation + assert_equal 2, copied_second_issue.relations.size, "Relation not copied" + copied_relation = copied_second_issue.relations.select {|r| r.relation_type == 'duplicates'}.first + assert_equal "duplicates", copied_relation.relation_type + assert_equal 1, copied_relation.issue_from_id, "Cross project relation not kept" + assert_not_equal source_relation_cross_project.id, copied_relation.id + end + should "copy members" do assert @project.valid? assert @project.members.empty? @@ -692,9 +727,6 @@ class ProjectTest < ActiveSupport::TestCase assert @project.issues.empty? end - should "copy issue relations" - should "link issue relations if cross project issue relations are valid" - end end |