summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_relation_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-03-17 15:02:57 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-03-17 15:02:57 +0000
commit38b3e045cf221e8d1aad1ea7fd9e2a86ea0ff5f6 (patch)
tree374354c3d09066ec44a8bb8881a6bd5afc5e2bb1 /test/unit/issue_relation_test.rb
parentb1afd75620529f855a83bf1202c9dfb630258568 (diff)
downloadredmine-38b3e045cf221e8d1aad1ea7fd9e2a86ea0ff5f6.tar.gz
redmine-38b3e045cf221e8d1aad1ea7fd9e2a86ea0ff5f6.zip
Fixed: Circular loop when using relations and subtasks (#8794).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11641 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_relation_test.rb')
-rw-r--r--test/unit/issue_relation_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/unit/issue_relation_test.rb b/test/unit/issue_relation_test.rb
index ab67592e0..f15a74c34 100644
--- a/test/unit/issue_relation_test.rb
+++ b/test/unit/issue_relation_test.rb
@@ -30,6 +30,8 @@ class IssueRelationTest < ActiveSupport::TestCase
:enumerations,
:trackers
+ include Redmine::I18n
+
def test_create
from = Issue.find(1)
to = Issue.find(2)
@@ -115,6 +117,26 @@ class IssueRelationTest < ActiveSupport::TestCase
assert_not_nil r.errors[:base]
end
+ def test_validates_circular_dependency_of_subtask
+ set_language_if_valid 'en'
+ issue1 = Issue.generate!
+ issue2 = Issue.generate!
+ IssueRelation.create!(
+ :issue_from => issue1, :issue_to => issue2,
+ :relation_type => IssueRelation::TYPE_PRECEDES
+ )
+ child = Issue.generate!(:parent_issue_id => issue2.id)
+ issue1.reload
+ child.reload
+
+ r = IssueRelation.new(
+ :issue_from => child, :issue_to => issue1,
+ :relation_type => IssueRelation::TYPE_PRECEDES
+ )
+ assert !r.save
+ assert_include 'This relation would create a circular dependency', r.errors.full_messages
+ end
+
def test_validates_circular_dependency_on_reverse_relations
IssueRelation.delete_all
assert IssueRelation.create!(