code layout cleanup test/unit/issue_relation_test.rb
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10573 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
727aad50b7
commit
178f64950f
|
@ -99,18 +99,36 @@ class IssueRelationTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
def test_validates_circular_dependency
|
def test_validates_circular_dependency
|
||||||
IssueRelation.delete_all
|
IssueRelation.delete_all
|
||||||
assert IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(2), :relation_type => IssueRelation::TYPE_PRECEDES)
|
assert IssueRelation.create!(
|
||||||
assert IssueRelation.create!(:issue_from => Issue.find(2), :issue_to => Issue.find(3), :relation_type => IssueRelation::TYPE_PRECEDES)
|
:issue_from => Issue.find(1), :issue_to => Issue.find(2),
|
||||||
r = IssueRelation.new(:issue_from => Issue.find(3), :issue_to => Issue.find(1), :relation_type => IssueRelation::TYPE_PRECEDES)
|
: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 !r.save
|
||||||
assert_not_nil r.errors[:base]
|
assert_not_nil r.errors[:base]
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_validates_circular_dependency_on_reverse_relations
|
def test_validates_circular_dependency_on_reverse_relations
|
||||||
IssueRelation.delete_all
|
IssueRelation.delete_all
|
||||||
assert IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(3), :relation_type => IssueRelation::TYPE_BLOCKS)
|
assert IssueRelation.create!(
|
||||||
assert IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(2), :relation_type => IssueRelation::TYPE_BLOCKED)
|
:issue_from => Issue.find(1), :issue_to => Issue.find(3),
|
||||||
r = IssueRelation.new(:issue_from => Issue.find(2), :issue_to => Issue.find(1), :relation_type => IssueRelation::TYPE_BLOCKED)
|
:relation_type => IssueRelation::TYPE_BLOCKS
|
||||||
|
)
|
||||||
|
assert IssueRelation.create!(
|
||||||
|
:issue_from => Issue.find(1), :issue_to => Issue.find(2),
|
||||||
|
:relation_type => IssueRelation::TYPE_BLOCKED
|
||||||
|
)
|
||||||
|
r = IssueRelation.new(
|
||||||
|
:issue_from => Issue.find(2), :issue_to => Issue.find(1),
|
||||||
|
:relation_type => IssueRelation::TYPE_BLOCKED
|
||||||
|
)
|
||||||
assert !r.save
|
assert !r.save
|
||||||
assert_not_nil r.errors[:base]
|
assert_not_nil r.errors[:base]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue