From 2b69a96d6db89eb089fa14dc824e91ec7d33f463 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Sun, 31 Oct 2010 23:55:50 +0000 Subject: [PATCH] Merged r4263 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@4323 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue.rb | 4 ++-- test/unit/issue_test.rb | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index d7d752d2b..0301ee857 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -68,8 +68,8 @@ class Issue < ActiveRecord::Base :conditions => ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"] 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 diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index a5d6c1a38..d96a46906 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -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? -- 2.39.5