summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2018-06-10 05:57:12 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2018-06-10 05:57:12 +0000
commitc2bdc811242f35470bb266b808b72fc829b9fbd5 (patch)
tree24c4cb5e0249867246cb60ffc6293d5311197d22 /test/unit/issue_test.rb
parent317ebfb100b4d25d13ec1329d636b67d5adbcc6e (diff)
downloadredmine-c2bdc811242f35470bb266b808b72fc829b9fbd5.tar.gz
redmine-c2bdc811242f35470bb266b808b72fc829b9fbd5.zip
Log automatic rescheduling of following issues to journal (#28649).
git-svn-id: http://svn.redmine.org/redmine/trunk@17373 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r--test/unit/issue_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 0d9f4c250..d99402a52 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -2158,6 +2158,32 @@ class IssueTest < ActiveSupport::TestCase
assert_equal Date.parse('2012-09-21'), issue2.due_date
end
+ def test_rescheduling_an_issue_to_a_different_due_date_should_add_journal_to_following_issue
+ 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-18', :due_date => '2012-10-20')
+ IssueRelation.create!(:issue_from => issue1, :issue_to => issue2,
+ :relation_type => IssueRelation::TYPE_PRECEDES)
+
+ assert_difference 'issue2.journals.count' do
+ issue1.reload
+ issue1.init_journal(User.find(3))
+ issue1.due_date = '2012-10-23'
+ issue1.save!
+ end
+ journal = issue2.journals.order(:id).last
+
+ start_date_detail = journal.details.find_by(:prop_key => 'start_date')
+ assert_equal '2012-10-18', start_date_detail.old_value
+ assert_equal '2012-10-24', start_date_detail.value
+
+ due_date_detail = journal.details.find_by(:prop_key => 'due_date')
+ assert_equal '2012-10-20', due_date_detail.old_value
+ assert_equal '2012-10-26', due_date_detail.value
+ end
+ end
+
+
def test_rescheduling_reschedule_following_issue_earlier_should_consider_other_preceding_issues
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')