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