issue_relation_test.patch

Uwe Koloska, 2014-09-05 16:42

Download (1.82 KB)

View differences:

branches/2.5-stable/test/unit/issue_relation_test.rb (Arbeitskopie)
118 118
    assert_not_equal [], r.errors[:base]
119 119
  end
120 120

  
121
  def test_validates_no_circular_dependency_for_relates
122
    IssueRelation.delete_all
123
    assert IssueRelation.create!(
124
             :issue_from => Issue.find(1), :issue_to => Issue.find(2),
125
             :relation_type => IssueRelation::TYPE_RELATES
126
           )
127
    assert IssueRelation.create!(
128
             :issue_from => Issue.find(2), :issue_to => Issue.find(3),
129
             :relation_type => IssueRelation::TYPE_RELATES
130
           )
131
    r = IssueRelation.new(
132
          :issue_from => Issue.find(3), :issue_to => Issue.find(1),
133
          :relation_type => IssueRelation::TYPE_RELATES
134
        )
135
    assert r.save
136
  end
137

  
138
  def test_validates_no_circular_dependency_for_relates_reverse_last
139
    IssueRelation.delete_all
140
    assert IssueRelation.create!(
141
             :issue_from => Issue.find(1), :issue_to => Issue.find(2),
142
             :relation_type => IssueRelation::TYPE_RELATES
143
           )
144
    assert IssueRelation.create!(
145
             :issue_from => Issue.find(2), :issue_to => Issue.find(3),
146
             :relation_type => IssueRelation::TYPE_RELATES
147
           )
148
    r = IssueRelation.new(
149
          :issue_from => Issue.find(1), :issue_to => Issue.find(3),
150
          :relation_type => IssueRelation::TYPE_RELATES
151
        )
152
    assert r.save
153
  end
154

  
121 155
  def test_validates_circular_dependency_of_subtask
122 156
    set_language_if_valid 'en'
123 157
    issue1 = Issue.generate!