@@ -892,7 +892,7 class Issue < ActiveRecord::Base | |||
|
892 | 892 | @soonest_start = nil if reload |
|
893 | 893 | @soonest_start ||= ( |
|
894 | 894 | relations_to(reload).collect{|relation| relation.successor_soonest_start} + |
|
895 | ancestors.collect(&:soonest_start) | |
|
895 | [(@parent_issue || parent).try(:soonest_start)] | |
|
896 | 896 | ).compact.max |
|
897 | 897 | end |
|
898 | 898 |
@@ -1512,6 +1512,25 class IssueTest < ActiveSupport::TestCase | |||
|
1512 | 1512 | end |
|
1513 | 1513 | end |
|
1514 | 1514 | |
|
1515 | def test_child_issue_should_consider_parent_soonest_start_on_create | |
|
1516 | set_language_if_valid 'en' | |
|
1517 | issue1 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17') | |
|
1518 | issue2 = Issue.generate!(:start_date => '2012-10-18', :due_date => '2012-10-20') | |
|
1519 | IssueRelation.create!(:issue_from => issue1, :issue_to => issue2, | |
|
1520 | :relation_type => IssueRelation::TYPE_PRECEDES) | |
|
1521 | issue1.reload | |
|
1522 | issue2.reload | |
|
1523 | assert_equal Date.parse('2012-10-18'), issue2.start_date | |
|
1524 | ||
|
1525 | child = Issue.new(:parent_issue_id => issue2.id, :start_date => '2012-10-16', | |
|
1526 | :project_id => 1, :tracker_id => 1, :status_id => 1, :subject => 'Child', :author_id => 1) | |
|
1527 | assert !child.valid? | |
|
1528 | assert_include 'Start date is invalid', child.errors.full_messages | |
|
1529 | assert_equal Date.parse('2012-10-18'), child.soonest_start | |
|
1530 | child.start_date = '2012-10-18' | |
|
1531 | assert child.save | |
|
1532 | end | |
|
1533 | ||
|
1515 | 1534 | def test_overdue |
|
1516 | 1535 | assert Issue.new(:due_date => 1.day.ago.to_date).overdue? |
|
1517 | 1536 | assert !Issue.new(:due_date => Date.today).overdue? |
General Comments 0
You need to be logged in to leave comments.
Login now