Fixed: precedes/follows relations no longer update start/due dates (#5803).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4263 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2010-10-19 19:16:50 +00:00
parent 297eb6f81b
commit f3baa5bfee
2 changed files with 13 additions and 2 deletions

View File

@ -86,8 +86,8 @@ class Issue < ActiveRecord::Base
}
before_create :default_assign
before_save :reschedule_following_issues, :close_duplicates, :update_done_ratio_from_issue_status
after_save :update_nested_set_attributes, :update_parent_attributes, :create_journal
before_save :close_duplicates, :update_done_ratio_from_issue_status
after_save :reschedule_following_issues, :update_nested_set_attributes, :update_parent_attributes, :create_journal
after_destroy :destroy_children
after_destroy :update_parent_attributes

View File

@ -503,6 +503,17 @@ class IssueTest < ActiveSupport::TestCase
assert !closed_statuses.empty?
end
def test_rescheduling_an_issue_should_reschedule_following_issue
issue1 = Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :subject => '-', :start_date => Date.today, :due_date => Date.today + 2)
issue2 = Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :subject => '-', :start_date => Date.today, :due_date => Date.today + 2)
IssueRelation.create!(:issue_from => issue1, :issue_to => issue2, :relation_type => IssueRelation::TYPE_PRECEDES)
assert_equal issue1.due_date + 1, issue2.reload.start_date
issue1.due_date = Date.today + 5
issue1.save!
assert_equal issue1.due_date + 1, issue2.reload.start_date
end
def test_overdue
assert Issue.new(:due_date => 1.day.ago.to_date).overdue?
assert !Issue.new(:due_date => Date.today).overdue?