diff options
-rw-r--r-- | app/models/issue.rb | 4 | ||||
-rw-r--r-- | 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 3fbbb4513..68d6a2bd5 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -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 diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 4438d854d..2227eddab 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? |