Commit d04576fd authored by jplang's avatar jplang

Fixed: Redmine::FieldFormat::IntFormat does not accept "real" Integer values (#18781).

git-svn-id: https://svn.redmine.org/redmine/trunk@13863 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 584de063
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment