Defect #27881 ยป fix-27881.diff
app/models/issue.rb (working copy) | ||
---|---|---|
440 | 440 |
end |
441 | 441 | |
442 | 442 |
def estimated_hours=(h) |
443 |
write_attribute :estimated_hours, (h.is_a?(String) ? h.to_hours : h)
|
|
443 |
write_attribute :estimated_hours, (h.is_a?(String) ? (h.to_hours || h) : h)
|
|
444 | 444 |
end |
445 | 445 | |
446 | 446 |
safe_attributes 'project_id', |
test/unit/issue_test.rb (working copy) | ||
---|---|---|
128 | 128 | |
129 | 129 |
def test_estimated_hours_should_be_validated |
130 | 130 |
set_language_if_valid 'en' |
131 |
['-2'].each do |invalid| |
|
131 |
['-2', '123abc'].each do |invalid|
|
|
132 | 132 |
issue = Issue.new(:estimated_hours => invalid) |
133 | 133 |
assert !issue.valid? |
134 | 134 |
assert_include 'Estimated time is invalid', issue.errors.full_messages |