summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-10 11:06:27 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-10 11:06:27 +0000
commita77d884157439c226342e789f13bd6bfe8dd4227 (patch)
tree3c1defe4bbcb7625df2b799cf4cfa85e772e7573
parentaca5bfdc05c20eb6eb39c2a5449548a2ad363474 (diff)
downloadredmine-a77d884157439c226342e789f13bd6bfe8dd4227.tar.gz
redmine-a77d884157439c226342e789f13bd6bfe8dd4227.zip
Fixed: Redmine::FieldFormat::IntFormat does not accept "real" Integer values (#18781).
git-svn-id: http://svn.redmine.org/redmine/trunk@13863 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/field_format.rb2
-rw-r--r--test/unit/custom_field_test.rb2
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb
index 34591bb5f..7ccc0ffc7 100644
--- a/lib/redmine/field_format.rb
+++ b/lib/redmine/field_format.rb
@@ -368,7 +368,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 =~ /^[+-]?\d+$/
+ errs << ::I18n.t('activerecord.errors.messages.not_a_number') unless value.to_s =~ /^[+-]?\d+$/
errs
end
diff --git a/test/unit/custom_field_test.rb b/test/unit/custom_field_test.rb
index c20d7f645..e1166c8c6 100644
--- a/test/unit/custom_field_test.rb
+++ b/test/unit/custom_field_test.rb
@@ -193,6 +193,7 @@ class CustomFieldTest < ActiveSupport::TestCase
assert f.valid_field_value?('+123')
assert f.valid_field_value?('-123')
assert !f.valid_field_value?('6abc')
+ assert f.valid_field_value?(123)
end
def test_float_field_validation
@@ -205,6 +206,7 @@ class CustomFieldTest < ActiveSupport::TestCase
assert f.valid_field_value?('-6.250')
assert f.valid_field_value?('5')
assert !f.valid_field_value?('6abc')
+ assert f.valid_field_value?(11.2)
end
def test_multi_field_validation