Adds settings to make the issue and/or comment fields mandatory for time logs (#24577).

Patch by Marius BALTEANU.

git-svn-id: http://svn.redmine.org/redmine/trunk@16176 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2017-01-12 23:09:18 +00:00
parent 82d96258f4
commit 04eefdc809
8 changed files with 29 additions and 2 deletions

View File

@@ -172,4 +172,13 @@ class TimeEntryTest < ActiveSupport::TestCase
:activity => activity)
assert_equal project.id, te.project.id
end
def test_create_with_required_issue_id_and_comment_should_be_validated
with_settings :timelog_required_fields => ['issue_id' , 'comments'] do
entry = TimeEntry.new(:project => Project.find(1), :spent_on => Date.today, :user => User.find(1), :activity => TimeEntryActivity.first, :hours => 1)
assert !entry.save
assert_equal ["Comment cannot be blank", "Issue cannot be blank"], entry.errors.full_messages.sort
end
end
end