From 0f9ea965e75ea08b2e3a329b45b41a8c829a8ce8 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Thu, 8 Mar 2018 07:44:54 +0000 Subject: Fix: Calculation of the start date of following issues ignores the "non-working days" setting (#14846). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Felix Schäfer. git-svn-id: http://svn.redmine.org/redmine/trunk@17230 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/issue_test.rb | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'test/unit/issue_test.rb') diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index cd17612d0..880c0a606 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -2078,18 +2078,30 @@ class IssueTest < ActiveSupport::TestCase end def test_rescheduling_an_issue_to_a_later_due_date_should_reschedule_following_issue - issue1 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17') - issue2 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17') - IssueRelation.create!(:issue_from => issue1, :issue_to => issue2, - :relation_type => IssueRelation::TYPE_PRECEDES) - assert_equal Date.parse('2012-10-18'), issue2.reload.start_date + with_settings :non_working_week_days => [] do + issue1 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17') + issue2 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17') + IssueRelation.create!(:issue_from => issue1, :issue_to => issue2, + :relation_type => IssueRelation::TYPE_PRECEDES) + assert_equal Date.parse('2012-10-18'), issue2.reload.start_date + + issue1.reload + issue1.due_date = '2012-10-23' + issue1.save! + issue2.reload + assert_equal Date.parse('2012-10-24'), issue2.start_date + assert_equal Date.parse('2012-10-26'), issue2.due_date + end - issue1.reload - issue1.due_date = '2012-10-23' - issue1.save! - issue2.reload - assert_equal Date.parse('2012-10-24'), issue2.start_date - assert_equal Date.parse('2012-10-26'), issue2.due_date + # The delay should honor non-working week days + with_settings :non_working_week_days => %w(6 7) do + issue1 = Issue.generate!(:start_date => '2014-03-10', :due_date => '2014-03-12') + issue2 = Issue.generate!(:start_date => '2014-03-10', :due_date => '2014-03-12') + IssueRelation.create!(:issue_from => issue1, :issue_to => issue2, + :relation_type => IssueRelation::TYPE_PRECEDES, + :delay => 8) + assert_equal Date.parse('2014-03-25'), issue2.reload.start_date + end end def test_rescheduling_an_issue_to_an_earlier_due_date_should_reschedule_following_issue -- cgit v1.2.3