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
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')
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')