summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-15 14:03:39 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-15 14:03:39 +0000
commitd2b6a6bc2cd4577038c7e8ad267c5aee3550ecb5 (patch)
tree3ca61b13c1dc95c2480738118af69727f8da9bf1 /test/unit
parentb2425dbe7f8046c7e268ace1225e47e42ee9eeb4 (diff)
downloadredmine-d2b6a6bc2cd4577038c7e8ad267c5aee3550ecb5.tar.gz
redmine-d2b6a6bc2cd4577038c7e8ad267c5aee3550ecb5.zip
Adds a test for issue circular dependency validation.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4721 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/issue_relation_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/unit/issue_relation_test.rb b/test/unit/issue_relation_test.rb
index 0bc45f31e..f0b8fd666 100644
--- a/test/unit/issue_relation_test.rb
+++ b/test/unit/issue_relation_test.rb
@@ -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