summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-03-10 03:50:47 +0000
committerGo MAEDA <maeda@farend.jp>2020-03-10 03:50:47 +0000
commit5917137d121bbca9a4a68f51beb4d59d87aa0651 (patch)
tree7a3e1bc9a497a7a949957619182e2f0a822582fe /test/unit/issue_test.rb
parent463e8163fc7edfea8319d7635866cc1f8d68b6ad (diff)
downloadredmine-5917137d121bbca9a4a68f51beb4d59d87aa0651.tar.gz
redmine-5917137d121bbca9a4a68f51beb4d59d87aa0651.zip
Show warning and the reason when the issue cannot be closed or reopen because of open subtask(s), blocking issue(s) or closed parent issue (#31589).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@19570 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r--test/unit/issue_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 3bd5927c0..aea76e34f 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -2104,6 +2104,10 @@ class IssueTest < ActiveSupport::TestCase
child = Issue.generate!(:parent_issue_id => parent.id)
allowed_statuses = parent.reload.new_statuses_allowed_to(users(:users_002))
+
+ assert !parent.closable?
+ assert_equal l(:notice_issue_not_closable_by_open_tasks), parent.transition_warning
+
assert allowed_statuses.any?
assert_equal [], allowed_statuses.select(&:is_closed?)
end
@@ -2113,6 +2117,9 @@ class IssueTest < ActiveSupport::TestCase
child = Issue.generate!(:parent_issue_id => parent.id, :status_id => 5)
allowed_statuses = parent.reload.new_statuses_allowed_to(users(:users_002))
+
+ assert parent.closable?
+ assert_nil parent.transition_warning
assert allowed_statuses.any?
assert allowed_statuses.select(&:is_closed?).any?
end
@@ -3285,4 +3292,23 @@ class IssueTest < ActiveSupport::TestCase
User.current = user_in_asia
assert issue.overdue?
end
+
+ def test_closable
+ issue10 = Issue.find(10)
+ assert issue10.closable?
+ assert_nil issue10.transition_warning
+
+ # Issue blocked by another issue
+ issue9 = Issue.find(9)
+ assert !issue9.closable?
+ assert_equal l(:notice_issue_not_closable_by_blocking_issue), issue9.transition_warning
+ end
+
+ def test_reopenable
+ parent = Issue.generate!(:status_id => 5)
+ child = parent.generate_child!(:status_id => 5)
+
+ assert !child.reopenable?
+ assert_equal l(:notice_issue_not_reopenable_by_closed_parent_issue), child.transition_warning
+ end
end