Commit f3baa5bf authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

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
parent 297eb6f8
...@@ -86,8 +86,8 @@ class Issue < ActiveRecord::Base ...@@ -86,8 +86,8 @@ class Issue < ActiveRecord::Base
} }
before_create :default_assign before_create :default_assign
before_save :reschedule_following_issues, :close_duplicates, :update_done_ratio_from_issue_status before_save :close_duplicates, :update_done_ratio_from_issue_status
after_save :update_nested_set_attributes, :update_parent_attributes, :create_journal after_save :reschedule_following_issues, :update_nested_set_attributes, :update_parent_attributes, :create_journal
after_destroy :destroy_children after_destroy :destroy_children
after_destroy :update_parent_attributes after_destroy :update_parent_attributes
......
...@@ -503,6 +503,17 @@ class IssueTest < ActiveSupport::TestCase ...@@ -503,6 +503,17 @@ class IssueTest < ActiveSupport::TestCase
assert !closed_statuses.empty? assert !closed_statuses.empty?
end 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 def test_overdue
assert Issue.new(:due_date => 1.day.ago.to_date).overdue? assert Issue.new(:due_date => 1.day.ago.to_date).overdue?
assert !Issue.new(:due_date => Date.today).overdue? assert !Issue.new(:due_date => Date.today).overdue?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment