Commit f4c4ca3d authored by jplang's avatar jplang

Do not validate blank default custom field value.

git-svn-id: https://svn.redmine.org/redmine/trunk@8722 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 92f3f8ba
......@@ -57,7 +57,7 @@ class CustomField < ActiveRecord::Base
end
end
unless valid_field_value?(default_value)
if default_value.present? && !valid_field_value?(default_value)
errors.add(:default_value, :invalid)
end
end
......
......@@ -52,6 +52,11 @@ class CustomFieldTest < ActiveSupport::TestCase
assert field.valid?
end
def test_default_value_should_not_be_validated_when_blank
field = CustomField.new(:name => 'Test', :field_format => 'list', :possible_values => ['a', 'b'], :is_required => true, :default_value => '')
assert field.valid?
end
def test_possible_values_should_accept_an_array
field = CustomField.new
field.possible_values = ["One value", ""]
......
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