]> source.dussan.org Git - redmine.git/commitdiff
Adds a test for issue circular dependency validation.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 15 Jan 2011 14:03:39 +0000 (14:03 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 15 Jan 2011 14:03:39 +0000 (14:03 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4721 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/issue_relation_test.rb

index 0bc45f31ec1eeeab515ebe425c21bfcd7f61bd61..f0b8fd66604285769d7885890bb1a673f9111fe7 100644 (file)
@@ -73,4 +73,13 @@ class IssueRelationTest < ActiveSupport::TestCase
     r = IssueRelation.new(:relation_type => IssueRelation::TYPE_PRECEDES, :delay => 1)
     assert_nil r.set_issue_to_dates
   end
+  
+  def test_validates_circular_dependency
+    IssueRelation.delete_all
+    assert IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(2), :relation_type => IssueRelation::TYPE_PRECEDES)
+    assert IssueRelation.create!(:issue_from => Issue.find(2), :issue_to => Issue.find(3), :relation_type => IssueRelation::TYPE_PRECEDES)
+    r = IssueRelation.new(:issue_from => Issue.find(3), :issue_to => Issue.find(1), :relation_type => IssueRelation::TYPE_PRECEDES)
+    assert !r.save
+    assert_not_nil r.errors.on(:base)
+  end
 end