Mercurial > hg > soundsoftware-site
comparison test/unit/issue_relation_test.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children | 622f24f53b42 261b3d9a4903 |
comparison
equal
deleted
inserted
replaced
929:5f33065ddc4b | 1115:433d4f72a19b |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2011 Jean-Philippe Lang | 2 # Copyright (C) 2006-2012 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | 17 |
18 require File.expand_path('../../test_helper', __FILE__) | 18 require File.expand_path('../../test_helper', __FILE__) |
19 | 19 |
20 class IssueRelationTest < ActiveSupport::TestCase | 20 class IssueRelationTest < ActiveSupport::TestCase |
21 fixtures :issue_relations, :issues | 21 fixtures :projects, |
22 :users, | |
23 :roles, | |
24 :members, | |
25 :member_roles, | |
26 :issues, | |
27 :issue_statuses, | |
28 :issue_relations, | |
29 :enabled_modules, | |
30 :enumerations, | |
31 :trackers | |
22 | 32 |
23 def test_create | 33 def test_create |
24 from = Issue.find(1) | 34 from = Issue.find(1) |
25 to = Issue.find(2) | 35 to = Issue.find(2) |
26 | 36 |
87 assert_nil r.set_issue_to_dates | 97 assert_nil r.set_issue_to_dates |
88 end | 98 end |
89 | 99 |
90 def test_validates_circular_dependency | 100 def test_validates_circular_dependency |
91 IssueRelation.delete_all | 101 IssueRelation.delete_all |
92 assert IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(2), :relation_type => IssueRelation::TYPE_PRECEDES) | 102 assert IssueRelation.create!( |
93 assert IssueRelation.create!(:issue_from => Issue.find(2), :issue_to => Issue.find(3), :relation_type => IssueRelation::TYPE_PRECEDES) | 103 :issue_from => Issue.find(1), :issue_to => Issue.find(2), |
94 r = IssueRelation.new(:issue_from => Issue.find(3), :issue_to => Issue.find(1), :relation_type => IssueRelation::TYPE_PRECEDES) | 104 :relation_type => IssueRelation::TYPE_PRECEDES |
105 ) | |
106 assert IssueRelation.create!( | |
107 :issue_from => Issue.find(2), :issue_to => Issue.find(3), | |
108 :relation_type => IssueRelation::TYPE_PRECEDES | |
109 ) | |
110 r = IssueRelation.new( | |
111 :issue_from => Issue.find(3), :issue_to => Issue.find(1), | |
112 :relation_type => IssueRelation::TYPE_PRECEDES | |
113 ) | |
95 assert !r.save | 114 assert !r.save |
96 assert_not_nil r.errors[:base] | 115 assert_not_nil r.errors[:base] |
97 end | 116 end |
98 | 117 |
99 def test_validates_circular_dependency_on_reverse_relations | 118 def test_validates_circular_dependency_on_reverse_relations |
100 IssueRelation.delete_all | 119 IssueRelation.delete_all |
101 assert IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(3), :relation_type => IssueRelation::TYPE_BLOCKS) | 120 assert IssueRelation.create!( |
102 assert IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(2), :relation_type => IssueRelation::TYPE_BLOCKED) | 121 :issue_from => Issue.find(1), :issue_to => Issue.find(3), |
103 r = IssueRelation.new(:issue_from => Issue.find(2), :issue_to => Issue.find(1), :relation_type => IssueRelation::TYPE_BLOCKED) | 122 :relation_type => IssueRelation::TYPE_BLOCKS |
123 ) | |
124 assert IssueRelation.create!( | |
125 :issue_from => Issue.find(1), :issue_to => Issue.find(2), | |
126 :relation_type => IssueRelation::TYPE_BLOCKED | |
127 ) | |
128 r = IssueRelation.new( | |
129 :issue_from => Issue.find(2), :issue_to => Issue.find(1), | |
130 :relation_type => IssueRelation::TYPE_BLOCKED | |
131 ) | |
104 assert !r.save | 132 assert !r.save |
105 assert_not_nil r.errors[:base] | 133 assert_not_nil r.errors[:base] |
106 end | 134 end |
107 end | 135 end |