stale.patch

Pavel Rosick√Ĺ, 2020-01-29 00:35

Download (3.19 KB)

View differences:

object_helpers.rb (working copy)
105 105
  def Issue.generate!(attributes={}, &block)
106 106
    issue = Issue.generate(attributes, &block)
107 107
    issue.save!
108
    issue
108
    issue.reload
109 109
  end
110 110

  
111 111
  # Generates an issue with 2 children and a grandchild
unit/issue_test.rb (working copy)
1402 1402
    copy = issue.reload.copy
1403 1403
    assert_difference 'Issue.count', 1+issue.descendants.count do
1404 1404
      assert copy.save
1405
      assert copy.save
1405
      assert copy.reload.save
1406 1406
    end
1407 1407
  end
1408 1408

  
......
2429 2429
    relation = new_record(IssueRelation) do
2430 2430
      copy.save!
2431 2431
    end
2432
    copy.reload
2432 2433

  
2433 2434
    copy.parent_issue_id = parent.id
2434 2435
    assert_save copy
......
2683 2684
                                     :possible_values => ['value1', 'value2', 'value3'],
2684 2685
                                     :multiple => true)
2685 2686

  
2686
    issue = Issue.create!(:project_id => 1, :tracker_id => 1,
2687
    issue = Issue.generate!(:project_id => 1, :tracker_id => 1,
2687 2688
                          :subject => 'Test', :author_id => 1)
2688 2689

  
2689 2690
    assert_difference 'Journal.count' do
unit/project_test.rb (working copy)
243 243
  end
244 244

  
245 245
  def test_destroy_should_destroy_subtasks
246
    issues = (0..2).to_a.map {Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 1, :subject => 'test')}
246
    issues = (0..2).to_a.map {Issue.generate!(:project_id => 1, :tracker_id => 1, :author_id => 1, :subject => 'test')}
247 247
    issues[0].update! :parent_issue_id => issues[1].id
248 248
    issues[2].update! :parent_issue_id => issues[1].id
249 249
    assert_equal 2, issues[1].children.count
unit/user_test.rb (working copy)
305 305
  end
306 306

  
307 307
  def test_destroy_should_update_journals
308
    issue = Issue.create!(:project_id => 1, :author_id => 2,
308
    issue = Issue.generate!(:project_id => 1, :author_id => 2,
309 309
                          :tracker_id => 1, :subject => 'foo')
310 310
    issue.init_journal(User.find(2), "update")
311 311
    issue.save!
......
316 316
  end
317 317

  
318 318
  def test_destroy_should_update_journal_details_old_value
319
    issue = Issue.create!(:project_id => 1, :author_id => 1,
319
    issue = Issue.generate!(:project_id => 1, :author_id => 1,
320 320
                          :tracker_id => 1, :subject => 'foo', :assigned_to_id => 2)
321 321
    issue.init_journal(User.find(1), "update")
322 322
    issue.assigned_to_id = nil
......
332 332
  end
333 333

  
334 334
  def test_destroy_should_update_journal_details_value
335
    issue = Issue.create!(:project_id => 1, :author_id => 1,
335
    issue = Issue.generate!(:project_id => 1, :author_id => 1,
336 336
                          :tracker_id => 1, :subject => 'foo')
337 337
    issue.init_journal(User.find(1), "update")
338 338
    issue.assigned_to_id = 2