summaryrefslogtreecommitdiffstats
path: root/test/unit/project_copy_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-01-13 00:59:17 +0000
committerGo MAEDA <maeda@farend.jp>2022-01-13 00:59:17 +0000
commit9bfa91ea3854865c5f93ed090eb2f679547ae9ec (patch)
treeaf4c2e1a65922e79701024f65cfb9b28d9da0175 /test/unit/project_copy_test.rb
parent9670c7fe2231c36595e1135e691c3eb2ebfa2a3d (diff)
downloadredmine-9bfa91ea3854865c5f93ed090eb2f679547ae9ec.tar.gz
redmine-9bfa91ea3854865c5f93ed090eb2f679547ae9ec.zip
Restore the value of Setting.cross_project_issue_relations to prevent random test failures (#36361).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@21363 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_copy_test.rb')
-rw-r--r--test/unit/project_copy_test.rb54
1 files changed, 27 insertions, 27 deletions
diff --git a/test/unit/project_copy_test.rb b/test/unit/project_copy_test.rb
index 29cac3327..c05d4f430 100644
--- a/test/unit/project_copy_test.rb
+++ b/test/unit/project_copy_test.rb
@@ -173,38 +173,38 @@ class ProjectCopyTest < ActiveSupport::TestCase
end
test "#copy 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.create!(:issue_from => Issue.find(4),
+ with_settings :cross_project_issue_relations => '1' do
+ 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.create!(:issue_from => Issue.find(4),
:issue_to => second_issue,
:relation_type => "relates")
- source_relation_cross_project = IssueRelation.create!(:issue_from => Issue.find(1),
+ source_relation_cross_project = IssueRelation.create!(: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.find {|r| r.relation_type == 'duplicates'}
- 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
+ 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.find {|r| r.relation_type == 'duplicates'}
+ 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
end
test "#copy should copy issue attachments" do