add_parent_issue.patch

Mizuki ISHIKAWA, 2018-04-11 06:09

Download (3.16 KB)

View differences:

app/models/mail_handler.rb
429 429
      'start_date' => get_keyword(:start_date, :format => '\d{4}-\d{2}-\d{2}'),
430 430
      'due_date' => get_keyword(:due_date, :format => '\d{4}-\d{2}-\d{2}'),
431 431
      'estimated_hours' => get_keyword(:estimated_hours),
432
      'done_ratio' => get_keyword(:done_ratio, :format => '(\d|10)?0')
432
      'done_ratio' => get_keyword(:done_ratio, :format => '(\d|10)?0'),
433
      'parent_issue_id' => get_keyword(:parent_issue)
433 434
    }.delete_if {|k, v| v.blank? }
434 435

  
435 436
    attrs
test/fixtures/mail_handler/ticket_on_given_project.eml
38 38
fixed version: alpha
39 39
estimated hours: 2.5
40 40
done ratio: 30
41
parent issue: 4
41 42

  
42 43
--- This line starts with a delimiter and should not be stripped
43 44

  
test/unit/mail_handler_test.rb
43 43
  def test_add_issue_with_specific_overrides
44 44
    issue = submit_email('ticket_on_given_project.eml',
45 45
      :allow_override => ['status', 'start_date', 'due_date', 'assigned_to',
46
                          'fixed_version', 'estimated_hours', 'done_ratio']
46
                          'fixed_version', 'estimated_hours', 'done_ratio', 'parent_issue']
47 47
    )
48 48
    assert issue.is_a?(Issue)
49 49
    assert !issue.new_record?
......
60 60
    assert_equal Version.find_by_name('Alpha'), issue.fixed_version
61 61
    assert_equal 2.5, issue.estimated_hours
62 62
    assert_equal 30, issue.done_ratio
63
    assert_equal Issue.find(4), issue.parent
63 64
    # keywords should be removed from the email body
64 65
    assert !issue.description.match(/^Project:/i)
65 66
    assert !issue.description.match(/^Status:/i)
......
81 82
    assert_equal Version.find_by_name('Alpha'), issue.fixed_version
82 83
    assert_equal 2.5, issue.estimated_hours
83 84
    assert_equal 30, issue.done_ratio
85
    assert_equal Issue.find(4), issue.parent
84 86
  end
85 87

  
86 88
  def test_add_issue_without_overrides_should_ignore_attributes
......
102 104
    assert_nil issue.fixed_version
103 105
    assert_nil issue.estimated_hours
104 106
    assert_equal 0, issue.done_ratio
107
    assert_nil issue.parent
105 108
  end
106 109

  
107 110
  def test_add_issue_to_project_specified_by_subaddress
......
474 477
      assert_nil issue.start_date
475 478
      assert_nil issue.due_date
476 479
      assert_equal 0, issue.done_ratio
480
      assert_nil issue.parent
477 481
      assert_equal 'Normal', issue.priority.to_s
478 482
      assert issue.description.include?('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.')
479 483
    end