1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 15:01:14 +00:00

Merged r4263 from trunk.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@4323 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis 2010-10-31 23:55:50 +00:00
parent 50cb1be8fd
commit 2b69a96d6d
2 changed files with 13 additions and 2 deletions

View File

@ -68,8 +68,8 @@ class Issue < ActiveRecord::Base
:conditions => ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"] :conditions => ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"]
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

View File

@ -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?