summaryrefslogtreecommitdiffstats
path: root/test/unit/time_entry_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-09-20 04:43:20 +0000
committerGo MAEDA <maeda@farend.jp>2023-09-20 04:43:20 +0000
commit3928d82ee101752567d7086824f91d463be90745 (patch)
treeead2d8cd58f9f93be90131045d6e2b0dd6bdb2be /test/unit/time_entry_test.rb
parentc9aed18ee58f20dc33f796bc864cfbccc9a52409 (diff)
downloadredmine-3928d82ee101752567d7086824f91d463be90745.tar.gz
redmine-3928d82ee101752567d7086824f91d463be90745.zip
Avoid exception during validation if the spent_on date of a time entry was removed (#39079).
Patch by Holger Just. git-svn-id: https://svn.redmine.org/redmine/trunk@22311 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/time_entry_test.rb')
-rw-r--r--test/unit/time_entry_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/unit/time_entry_test.rb b/test/unit/time_entry_test.rb
index 7f992e970..e1013afd7 100644
--- a/test/unit/time_entry_test.rb
+++ b/test/unit/time_entry_test.rb
@@ -171,6 +171,16 @@ class TimeEntryTest < ActiveSupport::TestCase
end
end
+ def test_should_require_spent_on
+ with_settings :timelog_accept_future_dates => '0' do
+ entry = TimeEntry.find(1)
+ entry.spent_on = ''
+
+ assert !entry.save
+ assert entry.errors[:spent_on].present?
+ end
+ end
+
def test_spent_on_with_blank
c = TimeEntry.new
c.spent_on = ''