@@ -859,10 +859,14 class Issue < ActiveRecord::Base | |||
|
859 | 859 | dependencies = [] |
|
860 | 860 | dependencies += relations_from.map(&:issue_to) |
|
861 | 861 | dependencies += children unless leaf? |
|
862 | dependencies << parent | |
|
863 | 862 | dependencies.compact! |
|
864 | 863 | dependencies -= except |
|
865 | dependencies + dependencies.map {|issue| issue.all_dependent_issues(except)}.flatten | |
|
864 | dependencies += dependencies.map {|issue| issue.all_dependent_issues(except)}.flatten | |
|
865 | if parent | |
|
866 | dependencies << parent | |
|
867 | dependencies += parent.all_dependent_issues(except + parent.descendants) | |
|
868 | end | |
|
869 | dependencies | |
|
866 | 870 | end |
|
867 | 871 | |
|
868 | 872 | # Returns an array of issues that duplicate this one |
@@ -137,6 +137,19 class IssueRelationTest < ActiveSupport::TestCase | |||
|
137 | 137 | assert_include 'This relation would create a circular dependency', r.errors.full_messages |
|
138 | 138 | end |
|
139 | 139 | |
|
140 | def test_subtasks_should_allow_precedes_relation | |
|
141 | parent = Issue.generate! | |
|
142 | child1 = Issue.generate!(:parent_issue_id => parent.id) | |
|
143 | child2 = Issue.generate!(:parent_issue_id => parent.id) | |
|
144 | ||
|
145 | r = IssueRelation.new( | |
|
146 | :issue_from => child1, :issue_to => child2, | |
|
147 | :relation_type => IssueRelation::TYPE_PRECEDES | |
|
148 | ) | |
|
149 | assert r.valid? | |
|
150 | assert r.save | |
|
151 | end | |
|
152 | ||
|
140 | 153 | def test_validates_circular_dependency_on_reverse_relations |
|
141 | 154 | IssueRelation.delete_all |
|
142 | 155 | assert IssueRelation.create!( |
General Comments 0
You need to be logged in to leave comments.
Login now