summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-03-08 07:44:54 +0000
committerGo MAEDA <maeda@farend.jp>2018-03-08 07:44:54 +0000
commit0f9ea965e75ea08b2e3a329b45b41a8c829a8ce8 (patch)
tree9952a00df88556f07fa391f0ff47564e7fd28740 /test/unit/issue_test.rb
parentea98d1897221361edac47d1dd30e4e29a7fdff3f (diff)
downloadredmine-0f9ea965e75ea08b2e3a329b45b41a8c829a8ce8.tar.gz
redmine-0f9ea965e75ea08b2e3a329b45b41a8c829a8ce8.zip
Fix: Calculation of the start date of following issues ignores the "non-working days" setting (#14846).
Patch by Felix Schäfer. git-svn-id: http://svn.redmine.org/redmine/trunk@17230 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r--test/unit/issue_test.rb34
1 files changed, 23 insertions, 11 deletions
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