From e8bc1dbaa80dd714254da9c19e4ffaae4fbf9736 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 7 Jan 2018 21:43:04 +0000 Subject: [PATCH] Merged r17144 to 3.4-stable (#27881). git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@17145 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue.rb | 2 +- test/unit/issue_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index 62a02e878..c84377dfb 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -441,7 +441,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', diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index ca038c877..8297335ca 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -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 -- 2.39.5