mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-26 18:31:14 +00:00
No validation errors when entering an invalid "Estimate hours" value (#27881).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@17144 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
ec53586af3
commit
2cb30321a2
@ -440,7 +440,7 @@ class Issue < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def estimated_hours=(h)
|
||||
write_attribute :estimated_hours, (h.is_a?(String) ? h.to_hours : h)
|
||||
write_attribute :estimated_hours, (h.is_a?(String) ? (h.to_hours || h) : h)
|
||||
end
|
||||
|
||||
safe_attributes 'project_id',
|
||||
|
||||
@ -128,7 +128,7 @@ class IssueTest < ActiveSupport::TestCase
|
||||
|
||||
def test_estimated_hours_should_be_validated
|
||||
set_language_if_valid 'en'
|
||||
['-2'].each do |invalid|
|
||||
['-2', '123abc'].each do |invalid|
|
||||
issue = Issue.new(:estimated_hours => invalid)
|
||||
assert !issue.valid?
|
||||
assert_include 'Estimated time is invalid', issue.errors.full_messages
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user