@@ -1,380 +1,380 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2011 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | require File.expand_path('../../test_helper', __FILE__) |
|
19 | 19 | |
|
20 | 20 | class IssueNestedSetTest < ActiveSupport::TestCase |
|
21 | 21 | fixtures :projects, :users, :members, :member_roles, :roles, |
|
22 | 22 | :trackers, :projects_trackers, |
|
23 | 23 | :versions, |
|
24 | 24 | :issue_statuses, :issue_categories, :issue_relations, :workflows, |
|
25 | 25 | :enumerations, |
|
26 | 26 | :issues, |
|
27 | 27 | :custom_fields, :custom_fields_projects, :custom_fields_trackers, :custom_values, |
|
28 | 28 | :time_entries |
|
29 | 29 | |
|
30 | 30 | self.use_transactional_fixtures = false |
|
31 | 31 | |
|
32 | 32 | def test_create_root_issue |
|
33 | 33 | issue1 = create_issue! |
|
34 | 34 | issue2 = create_issue! |
|
35 | 35 | issue1.reload |
|
36 | 36 | issue2.reload |
|
37 | 37 | |
|
38 | 38 | assert_equal [issue1.id, nil, 1, 2], [issue1.root_id, issue1.parent_id, issue1.lft, issue1.rgt] |
|
39 | 39 | assert_equal [issue2.id, nil, 1, 2], [issue2.root_id, issue2.parent_id, issue2.lft, issue2.rgt] |
|
40 | 40 | end |
|
41 | 41 | |
|
42 | 42 | def test_create_child_issue |
|
43 | 43 | parent = create_issue! |
|
44 | 44 | child = create_issue!(:parent_issue_id => parent.id) |
|
45 | 45 | parent.reload |
|
46 | 46 | child.reload |
|
47 | 47 | |
|
48 | 48 | assert_equal [parent.id, nil, 1, 4], [parent.root_id, parent.parent_id, parent.lft, parent.rgt] |
|
49 | 49 | assert_equal [parent.id, parent.id, 2, 3], [child.root_id, child.parent_id, child.lft, child.rgt] |
|
50 | 50 | end |
|
51 | 51 | |
|
52 | 52 | def test_creating_a_child_in_different_project_should_not_validate |
|
53 | 53 | issue = create_issue! |
|
54 | 54 | child = Issue.new(:project_id => 2, :tracker_id => 1, :author_id => 1, :subject => 'child', :parent_issue_id => issue.id) |
|
55 | 55 | assert !child.save |
|
56 |
assert_not_nil child.errors |
|
|
56 | assert_not_nil child.errors[:parent_issue_id] | |
|
57 | 57 | end |
|
58 | 58 | |
|
59 | 59 | def test_move_a_root_to_child |
|
60 | 60 | parent1 = create_issue! |
|
61 | 61 | parent2 = create_issue! |
|
62 | 62 | child = create_issue!(:parent_issue_id => parent1.id) |
|
63 | 63 | |
|
64 | 64 | parent2.parent_issue_id = parent1.id |
|
65 | 65 | parent2.save! |
|
66 | 66 | child.reload |
|
67 | 67 | parent1.reload |
|
68 | 68 | parent2.reload |
|
69 | 69 | |
|
70 | 70 | assert_equal [parent1.id, 1, 6], [parent1.root_id, parent1.lft, parent1.rgt] |
|
71 | 71 | assert_equal [parent1.id, 4, 5], [parent2.root_id, parent2.lft, parent2.rgt] |
|
72 | 72 | assert_equal [parent1.id, 2, 3], [child.root_id, child.lft, child.rgt] |
|
73 | 73 | end |
|
74 | 74 | |
|
75 | 75 | def test_move_a_child_to_root |
|
76 | 76 | parent1 = create_issue! |
|
77 | 77 | parent2 = create_issue! |
|
78 | 78 | child = create_issue!(:parent_issue_id => parent1.id) |
|
79 | 79 | |
|
80 | 80 | child.parent_issue_id = nil |
|
81 | 81 | child.save! |
|
82 | 82 | child.reload |
|
83 | 83 | parent1.reload |
|
84 | 84 | parent2.reload |
|
85 | 85 | |
|
86 | 86 | assert_equal [parent1.id, 1, 2], [parent1.root_id, parent1.lft, parent1.rgt] |
|
87 | 87 | assert_equal [parent2.id, 1, 2], [parent2.root_id, parent2.lft, parent2.rgt] |
|
88 | 88 | assert_equal [child.id, 1, 2], [child.root_id, child.lft, child.rgt] |
|
89 | 89 | end |
|
90 | 90 | |
|
91 | 91 | def test_move_a_child_to_another_issue |
|
92 | 92 | parent1 = create_issue! |
|
93 | 93 | parent2 = create_issue! |
|
94 | 94 | child = create_issue!(:parent_issue_id => parent1.id) |
|
95 | 95 | |
|
96 | 96 | child.parent_issue_id = parent2.id |
|
97 | 97 | child.save! |
|
98 | 98 | child.reload |
|
99 | 99 | parent1.reload |
|
100 | 100 | parent2.reload |
|
101 | 101 | |
|
102 | 102 | assert_equal [parent1.id, 1, 2], [parent1.root_id, parent1.lft, parent1.rgt] |
|
103 | 103 | assert_equal [parent2.id, 1, 4], [parent2.root_id, parent2.lft, parent2.rgt] |
|
104 | 104 | assert_equal [parent2.id, 2, 3], [child.root_id, child.lft, child.rgt] |
|
105 | 105 | end |
|
106 | 106 | |
|
107 | 107 | def test_move_a_child_with_descendants_to_another_issue |
|
108 | 108 | parent1 = create_issue! |
|
109 | 109 | parent2 = create_issue! |
|
110 | 110 | child = create_issue!(:parent_issue_id => parent1.id) |
|
111 | 111 | grandchild = create_issue!(:parent_issue_id => child.id) |
|
112 | 112 | |
|
113 | 113 | parent1.reload |
|
114 | 114 | parent2.reload |
|
115 | 115 | child.reload |
|
116 | 116 | grandchild.reload |
|
117 | 117 | |
|
118 | 118 | assert_equal [parent1.id, 1, 6], [parent1.root_id, parent1.lft, parent1.rgt] |
|
119 | 119 | assert_equal [parent2.id, 1, 2], [parent2.root_id, parent2.lft, parent2.rgt] |
|
120 | 120 | assert_equal [parent1.id, 2, 5], [child.root_id, child.lft, child.rgt] |
|
121 | 121 | assert_equal [parent1.id, 3, 4], [grandchild.root_id, grandchild.lft, grandchild.rgt] |
|
122 | 122 | |
|
123 | 123 | child.reload.parent_issue_id = parent2.id |
|
124 | 124 | child.save! |
|
125 | 125 | child.reload |
|
126 | 126 | grandchild.reload |
|
127 | 127 | parent1.reload |
|
128 | 128 | parent2.reload |
|
129 | 129 | |
|
130 | 130 | assert_equal [parent1.id, 1, 2], [parent1.root_id, parent1.lft, parent1.rgt] |
|
131 | 131 | assert_equal [parent2.id, 1, 6], [parent2.root_id, parent2.lft, parent2.rgt] |
|
132 | 132 | assert_equal [parent2.id, 2, 5], [child.root_id, child.lft, child.rgt] |
|
133 | 133 | assert_equal [parent2.id, 3, 4], [grandchild.root_id, grandchild.lft, grandchild.rgt] |
|
134 | 134 | end |
|
135 | 135 | |
|
136 | 136 | def test_move_a_child_with_descendants_to_another_project |
|
137 | 137 | parent1 = create_issue! |
|
138 | 138 | child = create_issue!(:parent_issue_id => parent1.id) |
|
139 | 139 | grandchild = create_issue!(:parent_issue_id => child.id) |
|
140 | 140 | |
|
141 | 141 | assert child.reload.move_to_project(Project.find(2)) |
|
142 | 142 | child.reload |
|
143 | 143 | grandchild.reload |
|
144 | 144 | parent1.reload |
|
145 | 145 | |
|
146 | 146 | assert_equal [1, parent1.id, 1, 2], [parent1.project_id, parent1.root_id, parent1.lft, parent1.rgt] |
|
147 | 147 | assert_equal [2, child.id, 1, 4], [child.project_id, child.root_id, child.lft, child.rgt] |
|
148 | 148 | assert_equal [2, child.id, 2, 3], [grandchild.project_id, grandchild.root_id, grandchild.lft, grandchild.rgt] |
|
149 | 149 | end |
|
150 | 150 | |
|
151 | 151 | def test_invalid_move_to_another_project |
|
152 | 152 | parent1 = create_issue! |
|
153 | 153 | child = create_issue!(:parent_issue_id => parent1.id) |
|
154 | 154 | grandchild = create_issue!(:parent_issue_id => child.id, :tracker_id => 2) |
|
155 | 155 | Project.find(2).tracker_ids = [1] |
|
156 | 156 | |
|
157 | 157 | parent1.reload |
|
158 | 158 | assert_equal [1, parent1.id, 1, 6], [parent1.project_id, parent1.root_id, parent1.lft, parent1.rgt] |
|
159 | 159 | |
|
160 | 160 | # child can not be moved to Project 2 because its child is on a disabled tracker |
|
161 | 161 | assert_equal false, Issue.find(child.id).move_to_project(Project.find(2)) |
|
162 | 162 | child.reload |
|
163 | 163 | grandchild.reload |
|
164 | 164 | parent1.reload |
|
165 | 165 | |
|
166 | 166 | # no change |
|
167 | 167 | assert_equal [1, parent1.id, 1, 6], [parent1.project_id, parent1.root_id, parent1.lft, parent1.rgt] |
|
168 | 168 | assert_equal [1, parent1.id, 2, 5], [child.project_id, child.root_id, child.lft, child.rgt] |
|
169 | 169 | assert_equal [1, parent1.id, 3, 4], [grandchild.project_id, grandchild.root_id, grandchild.lft, grandchild.rgt] |
|
170 | 170 | end |
|
171 | 171 | |
|
172 | 172 | def test_moving_an_issue_to_a_descendant_should_not_validate |
|
173 | 173 | parent1 = create_issue! |
|
174 | 174 | parent2 = create_issue! |
|
175 | 175 | child = create_issue!(:parent_issue_id => parent1.id) |
|
176 | 176 | grandchild = create_issue!(:parent_issue_id => child.id) |
|
177 | 177 | |
|
178 | 178 | child.reload |
|
179 | 179 | child.parent_issue_id = grandchild.id |
|
180 | 180 | assert !child.save |
|
181 | 181 | assert_not_nil child.errors.on(:parent_issue_id) |
|
182 | 182 | end |
|
183 | 183 | |
|
184 | 184 | def test_moving_an_issue_should_keep_valid_relations_only |
|
185 | 185 | issue1 = create_issue! |
|
186 | 186 | issue2 = create_issue! |
|
187 | 187 | issue3 = create_issue!(:parent_issue_id => issue2.id) |
|
188 | 188 | issue4 = create_issue! |
|
189 | 189 | r1 = IssueRelation.create!(:issue_from => issue1, :issue_to => issue2, :relation_type => IssueRelation::TYPE_PRECEDES) |
|
190 | 190 | r2 = IssueRelation.create!(:issue_from => issue1, :issue_to => issue3, :relation_type => IssueRelation::TYPE_PRECEDES) |
|
191 | 191 | r3 = IssueRelation.create!(:issue_from => issue2, :issue_to => issue4, :relation_type => IssueRelation::TYPE_PRECEDES) |
|
192 | 192 | issue2.reload |
|
193 | 193 | issue2.parent_issue_id = issue1.id |
|
194 | 194 | issue2.save! |
|
195 | 195 | assert !IssueRelation.exists?(r1.id) |
|
196 | 196 | assert !IssueRelation.exists?(r2.id) |
|
197 | 197 | assert IssueRelation.exists?(r3.id) |
|
198 | 198 | end |
|
199 | 199 | |
|
200 | 200 | def test_destroy_should_destroy_children |
|
201 | 201 | issue1 = create_issue! |
|
202 | 202 | issue2 = create_issue! |
|
203 | 203 | issue3 = create_issue!(:parent_issue_id => issue2.id) |
|
204 | 204 | issue4 = create_issue!(:parent_issue_id => issue1.id) |
|
205 | 205 | |
|
206 | 206 | issue3.init_journal(User.find(2)) |
|
207 | 207 | issue3.subject = 'child with journal' |
|
208 | 208 | issue3.save! |
|
209 | 209 | |
|
210 | 210 | assert_difference 'Issue.count', -2 do |
|
211 | 211 | assert_difference 'Journal.count', -1 do |
|
212 | 212 | assert_difference 'JournalDetail.count', -1 do |
|
213 | 213 | Issue.find(issue2.id).destroy |
|
214 | 214 | end |
|
215 | 215 | end |
|
216 | 216 | end |
|
217 | 217 | |
|
218 | 218 | issue1.reload |
|
219 | 219 | issue4.reload |
|
220 | 220 | assert !Issue.exists?(issue2.id) |
|
221 | 221 | assert !Issue.exists?(issue3.id) |
|
222 | 222 | assert_equal [issue1.id, 1, 4], [issue1.root_id, issue1.lft, issue1.rgt] |
|
223 | 223 | assert_equal [issue1.id, 2, 3], [issue4.root_id, issue4.lft, issue4.rgt] |
|
224 | 224 | end |
|
225 | 225 | |
|
226 | 226 | def test_destroy_parent_issue_updated_during_children_destroy |
|
227 | 227 | parent = create_issue! |
|
228 | 228 | create_issue!(:start_date => Date.today, :parent_issue_id => parent.id) |
|
229 | 229 | create_issue!(:start_date => 2.days.from_now, :parent_issue_id => parent.id) |
|
230 | 230 | |
|
231 | 231 | assert_difference 'Issue.count', -3 do |
|
232 | 232 | Issue.find(parent.id).destroy |
|
233 | 233 | end |
|
234 | 234 | end |
|
235 | 235 | |
|
236 | 236 | def test_destroy_child_issue_with_children |
|
237 | 237 | root = Issue.create!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'root') |
|
238 | 238 | child = Issue.create!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'child', :parent_issue_id => root.id) |
|
239 | 239 | leaf = Issue.create!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'leaf', :parent_issue_id => child.id) |
|
240 | 240 | leaf.init_journal(User.find(2)) |
|
241 | 241 | leaf.subject = 'leaf with journal' |
|
242 | 242 | leaf.save! |
|
243 | 243 | |
|
244 | 244 | assert_difference 'Issue.count', -2 do |
|
245 | 245 | assert_difference 'Journal.count', -1 do |
|
246 | 246 | assert_difference 'JournalDetail.count', -1 do |
|
247 | 247 | Issue.find(child.id).destroy |
|
248 | 248 | end |
|
249 | 249 | end |
|
250 | 250 | end |
|
251 | 251 | |
|
252 | 252 | root = Issue.find(root.id) |
|
253 | 253 | assert root.leaf?, "Root issue is not a leaf (lft: #{root.lft}, rgt: #{root.rgt})" |
|
254 | 254 | end |
|
255 | 255 | |
|
256 | 256 | def test_destroy_issue_with_grand_child |
|
257 | 257 | parent = create_issue! |
|
258 | 258 | issue = create_issue!(:parent_issue_id => parent.id) |
|
259 | 259 | child = create_issue!(:parent_issue_id => issue.id) |
|
260 | 260 | grandchild1 = create_issue!(:parent_issue_id => child.id) |
|
261 | 261 | grandchild2 = create_issue!(:parent_issue_id => child.id) |
|
262 | 262 | |
|
263 | 263 | assert_difference 'Issue.count', -4 do |
|
264 | 264 | Issue.find(issue.id).destroy |
|
265 | 265 | parent.reload |
|
266 | 266 | assert_equal [1, 2], [parent.lft, parent.rgt] |
|
267 | 267 | end |
|
268 | 268 | end |
|
269 | 269 | |
|
270 | 270 | def test_parent_priority_should_be_the_highest_child_priority |
|
271 | 271 | parent = create_issue!(:priority => IssuePriority.find_by_name('Normal')) |
|
272 | 272 | # Create children |
|
273 | 273 | child1 = create_issue!(:priority => IssuePriority.find_by_name('High'), :parent_issue_id => parent.id) |
|
274 | 274 | assert_equal 'High', parent.reload.priority.name |
|
275 | 275 | child2 = create_issue!(:priority => IssuePriority.find_by_name('Immediate'), :parent_issue_id => child1.id) |
|
276 | 276 | assert_equal 'Immediate', child1.reload.priority.name |
|
277 | 277 | assert_equal 'Immediate', parent.reload.priority.name |
|
278 | 278 | child3 = create_issue!(:priority => IssuePriority.find_by_name('Low'), :parent_issue_id => parent.id) |
|
279 | 279 | assert_equal 'Immediate', parent.reload.priority.name |
|
280 | 280 | # Destroy a child |
|
281 | 281 | child1.destroy |
|
282 | 282 | assert_equal 'Low', parent.reload.priority.name |
|
283 | 283 | # Update a child |
|
284 | 284 | child3.reload.priority = IssuePriority.find_by_name('Normal') |
|
285 | 285 | child3.save! |
|
286 | 286 | assert_equal 'Normal', parent.reload.priority.name |
|
287 | 287 | end |
|
288 | 288 | |
|
289 | 289 | def test_parent_dates_should_be_lowest_start_and_highest_due_dates |
|
290 | 290 | parent = create_issue! |
|
291 | 291 | create_issue!(:start_date => '2010-01-25', :due_date => '2010-02-15', :parent_issue_id => parent.id) |
|
292 | 292 | create_issue!( :due_date => '2010-02-13', :parent_issue_id => parent.id) |
|
293 | 293 | create_issue!(:start_date => '2010-02-01', :due_date => '2010-02-22', :parent_issue_id => parent.id) |
|
294 | 294 | parent.reload |
|
295 | 295 | assert_equal Date.parse('2010-01-25'), parent.start_date |
|
296 | 296 | assert_equal Date.parse('2010-02-22'), parent.due_date |
|
297 | 297 | end |
|
298 | 298 | |
|
299 | 299 | def test_parent_done_ratio_should_be_average_done_ratio_of_leaves |
|
300 | 300 | parent = create_issue! |
|
301 | 301 | create_issue!(:done_ratio => 20, :parent_issue_id => parent.id) |
|
302 | 302 | assert_equal 20, parent.reload.done_ratio |
|
303 | 303 | create_issue!(:done_ratio => 70, :parent_issue_id => parent.id) |
|
304 | 304 | assert_equal 45, parent.reload.done_ratio |
|
305 | 305 | |
|
306 | 306 | child = create_issue!(:done_ratio => 0, :parent_issue_id => parent.id) |
|
307 | 307 | assert_equal 30, parent.reload.done_ratio |
|
308 | 308 | |
|
309 | 309 | create_issue!(:done_ratio => 30, :parent_issue_id => child.id) |
|
310 | 310 | assert_equal 30, child.reload.done_ratio |
|
311 | 311 | assert_equal 40, parent.reload.done_ratio |
|
312 | 312 | end |
|
313 | 313 | |
|
314 | 314 | def test_parent_done_ratio_should_be_weighted_by_estimated_times_if_any |
|
315 | 315 | parent = create_issue! |
|
316 | 316 | create_issue!(:estimated_hours => 10, :done_ratio => 20, :parent_issue_id => parent.id) |
|
317 | 317 | assert_equal 20, parent.reload.done_ratio |
|
318 | 318 | create_issue!(:estimated_hours => 20, :done_ratio => 50, :parent_issue_id => parent.id) |
|
319 | 319 | assert_equal (50 * 20 + 20 * 10) / 30, parent.reload.done_ratio |
|
320 | 320 | end |
|
321 | 321 | |
|
322 | 322 | def test_parent_estimate_should_be_sum_of_leaves |
|
323 | 323 | parent = create_issue! |
|
324 | 324 | create_issue!(:estimated_hours => nil, :parent_issue_id => parent.id) |
|
325 | 325 | assert_equal nil, parent.reload.estimated_hours |
|
326 | 326 | create_issue!(:estimated_hours => 5, :parent_issue_id => parent.id) |
|
327 | 327 | assert_equal 5, parent.reload.estimated_hours |
|
328 | 328 | create_issue!(:estimated_hours => 7, :parent_issue_id => parent.id) |
|
329 | 329 | assert_equal 12, parent.reload.estimated_hours |
|
330 | 330 | end |
|
331 | 331 | |
|
332 | 332 | def test_move_parent_updates_old_parent_attributes |
|
333 | 333 | first_parent = create_issue! |
|
334 | 334 | second_parent = create_issue! |
|
335 | 335 | child = create_issue!(:estimated_hours => 5, :parent_issue_id => first_parent.id) |
|
336 | 336 | assert_equal 5, first_parent.reload.estimated_hours |
|
337 | 337 | child.update_attributes(:estimated_hours => 7, :parent_issue_id => second_parent.id) |
|
338 | 338 | assert_equal 7, second_parent.reload.estimated_hours |
|
339 | 339 | assert_nil first_parent.reload.estimated_hours |
|
340 | 340 | end |
|
341 | 341 | |
|
342 | 342 | def test_reschuling_a_parent_should_reschedule_subtasks |
|
343 | 343 | parent = create_issue! |
|
344 | 344 | c1 = create_issue!(:start_date => '2010-05-12', :due_date => '2010-05-18', :parent_issue_id => parent.id) |
|
345 | 345 | c2 = create_issue!(:start_date => '2010-06-03', :due_date => '2010-06-10', :parent_issue_id => parent.id) |
|
346 | 346 | parent.reload |
|
347 | 347 | parent.reschedule_after(Date.parse('2010-06-02')) |
|
348 | 348 | c1.reload |
|
349 | 349 | assert_equal [Date.parse('2010-06-02'), Date.parse('2010-06-08')], [c1.start_date, c1.due_date] |
|
350 | 350 | c2.reload |
|
351 | 351 | assert_equal [Date.parse('2010-06-03'), Date.parse('2010-06-10')], [c2.start_date, c2.due_date] # no change |
|
352 | 352 | parent.reload |
|
353 | 353 | assert_equal [Date.parse('2010-06-02'), Date.parse('2010-06-10')], [parent.start_date, parent.due_date] |
|
354 | 354 | end |
|
355 | 355 | |
|
356 | 356 | def test_project_copy_should_copy_issue_tree |
|
357 | 357 | p = Project.create!(:name => 'Tree copy', :identifier => 'tree-copy', :tracker_ids => [1, 2]) |
|
358 | 358 | i1 = create_issue!(:project_id => p.id, :subject => 'i1') |
|
359 | 359 | i2 = create_issue!(:project_id => p.id, :subject => 'i2', :parent_issue_id => i1.id) |
|
360 | 360 | i3 = create_issue!(:project_id => p.id, :subject => 'i3', :parent_issue_id => i1.id) |
|
361 | 361 | i4 = create_issue!(:project_id => p.id, :subject => 'i4', :parent_issue_id => i2.id) |
|
362 | 362 | i5 = create_issue!(:project_id => p.id, :subject => 'i5') |
|
363 | 363 | c = Project.new(:name => 'Copy', :identifier => 'copy', :tracker_ids => [1, 2]) |
|
364 | 364 | c.copy(p, :only => 'issues') |
|
365 | 365 | c.reload |
|
366 | 366 | |
|
367 | 367 | assert_equal 5, c.issues.count |
|
368 | 368 | ic1, ic2, ic3, ic4, ic5 = c.issues.find(:all, :order => 'subject') |
|
369 | 369 | assert ic1.root? |
|
370 | 370 | assert_equal ic1, ic2.parent |
|
371 | 371 | assert_equal ic1, ic3.parent |
|
372 | 372 | assert_equal ic2, ic4.parent |
|
373 | 373 | assert ic5.root? |
|
374 | 374 | end |
|
375 | 375 | |
|
376 | 376 | # Helper that creates an issue with default attributes |
|
377 | 377 | def create_issue!(attributes={}) |
|
378 | 378 | Issue.create!({:project_id => 1, :tracker_id => 1, :author_id => 1, :subject => 'test'}.merge(attributes)) |
|
379 | 379 | end |
|
380 | 380 | end |
General Comments 0
You need to be logged in to leave comments.
Login now