diff options
author | Go MAEDA <maeda@farend.jp> | 2018-11-11 00:50:58 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2018-11-11 00:50:58 +0000 |
commit | a9ea3c4e1564bf6d619eadb87a1048b2deaa88e8 (patch) | |
tree | 1cb538d9637fb477d3da9af6a527604120629583 | |
parent | a3cce4fef529332717ca7e8cf3571c5e0deed723 (diff) | |
download | redmine-a9ea3c4e1564bf6d619eadb87a1048b2deaa88e8.tar.gz redmine-a9ea3c4e1564bf6d619eadb87a1048b2deaa88e8.zip |
Merged r17625 from trunk to 3.3-stable (#8317).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@17628 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | lib/redmine/field_format.rb | 2 | ||||
-rw-r--r-- | test/unit/custom_field_test.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb index 71b439f6e..bdc0d1a98 100644 --- a/lib/redmine/field_format.rb +++ b/lib/redmine/field_format.rb @@ -424,7 +424,7 @@ module Redmine def validate_single_value(custom_field, value, customized=nil) errs = super - errs << ::I18n.t('activerecord.errors.messages.not_a_number') unless value.to_s =~ /^[+-]?\d+$/ + errs << ::I18n.t('activerecord.errors.messages.not_a_number') unless value.to_s.strip =~ /^[+-]?\d+$/ errs end diff --git a/test/unit/custom_field_test.rb b/test/unit/custom_field_test.rb index 461af85e4..fad69f984 100644 --- a/test/unit/custom_field_test.rb +++ b/test/unit/custom_field_test.rb @@ -204,6 +204,7 @@ class CustomFieldTest < ActiveSupport::TestCase assert f.valid_field_value?('') assert !f.valid_field_value?(' ') assert f.valid_field_value?('123') + assert f.valid_field_value?(' 123 ') assert f.valid_field_value?('+123') assert f.valid_field_value?('-123') assert !f.valid_field_value?('6abc') @@ -217,6 +218,7 @@ class CustomFieldTest < ActiveSupport::TestCase assert f.valid_field_value?('') assert !f.valid_field_value?(' ') assert f.valid_field_value?('11.2') + assert f.valid_field_value?(' 11.2 ') assert f.valid_field_value?('-6.250') assert f.valid_field_value?('5') assert !f.valid_field_value?('6abc') |