Index: test/unit/custom_field_test.rb =================================================================== --- test/unit/custom_field_test.rb (revision 12224) +++ test/unit/custom_field_test.rb (working copy) @@ -227,6 +227,24 @@ assert_equal 2, item_with_multiple_values.custom_field_value(other).size end + def test_searchable_should_be_set_for_string_text_list_custom_field_formats_only + Redmine::CustomFieldFormat.available_formats.each do |format| + if format == 'list' + field = CustomField.new(:name => 'test_searchable_list_cf', :field_format => format, :possible_values => ['v1', 'v2']) + else + field = CustomField.new(:name => 'test_searchable_' + format + '_cf', :field_format => format) + end + field.searchable = true + assert field.save + case format + when 'string', 'text', 'list' + assert_equal true, field.searchable, format + " custom field isn't searchable while it should" + when 'int', 'float', 'date', 'bool', 'user', 'version' + assert_equal false, field.searchable, format + " custom field is searchable while it shouldn't" + end + end + end + def test_value_class_should_return_the_class_used_for_fields_values assert_equal User, CustomField.new(:field_format => 'user').value_class assert_equal Version, CustomField.new(:field_format => 'version').value_class Index: app/models/custom_field.rb =================================================================== --- app/models/custom_field.rb (revision 12224) +++ app/models/custom_field.rb (working copy) @@ -64,7 +64,7 @@ def set_searchable # make sure these fields are not searchable - self.searchable = false if %w(int float date bool).include?(field_format) + self.searchable = false if %w(int float date bool user version).include?(field_format) # make sure only these fields can have multiple values self.multiple = false unless %w(list user version).include?(field_format) true