summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-06-07 00:33:29 +0000
committerGo MAEDA <maeda@farend.jp>2018-06-07 00:33:29 +0000
commit85db9769bc5f167466ddcaea2ff5c2583c86d681 (patch)
tree42249a3af5e95b73cedce052260ecbf91ab9c510 /test
parentbe7b5be79e00b774b66d52ccc5f24794ed5138f8 (diff)
downloadredmine-85db9769bc5f167466ddcaea2ff5c2583c86d681.tar.gz
redmine-85db9769bc5f167466ddcaea2ff5c2583c86d681.zip
Clear target version when copying an issue if status is locked or closed (#27863).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@17368 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/issue_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 48a12c6e4..0d9f4c250 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -1393,6 +1393,26 @@ class IssueTest < ActiveSupport::TestCase
assert !issue.watched_by?(user2)
end
+ def test_copy_should_clear_subtasks_target_version_if_locked_or_closed
+ version = Version.new(:project => Project.find(1), :name => '2.1',)
+ version.save!
+
+ parent = Issue.generate!
+ child1 = Issue.generate!(:parent_issue_id => parent.id, :subject => 'Child 1', :fixed_version_id => 3)
+ child2 = Issue.generate!(:parent_issue_id => parent.id, :subject => 'Child 2', :fixed_version_id => version.id)
+
+ version.status = 'locked'
+ version.save!
+
+ copy = parent.reload.copy
+
+ assert_difference 'Issue.count', 3 do
+ assert copy.save
+ end
+
+ assert_equal [3, nil], copy.children.map(&:fixed_version_id)
+ end
+
def test_should_not_call_after_project_change_on_creation
issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
:subject => 'Test', :author_id => 1)