summaryrefslogtreecommitdiffstats
path: root/test/unit/custom_field_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-11-09 09:07:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-11-09 09:07:48 +0000
commit10e29f22239e899072d922e2788843ee3785a76d (patch)
treea549bdbe0a237f6876715f29ae1d628eb245271d /test/unit/custom_field_test.rb
parent1871378648e1a35aa3afa8b80335215a22a956ec (diff)
downloadredmine-10e29f22239e899072d922e2788843ee3785a76d.tar.gz
redmine-10e29f22239e899072d922e2788843ee3785a76d.zip
Accept custom field format added at runtime (#15277).
Patch by Boris Bera. git-svn-id: http://svn.redmine.org/redmine/trunk@12248 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/custom_field_test.rb')
-rw-r--r--test/unit/custom_field_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/custom_field_test.rb b/test/unit/custom_field_test.rb
index 051853abc..b99fb4353 100644
--- a/test/unit/custom_field_test.rb
+++ b/test/unit/custom_field_test.rb
@@ -57,6 +57,20 @@ class CustomFieldTest < ActiveSupport::TestCase
assert field.valid?
end
+ def test_field_format_should_be_validated
+ field = CustomField.new(:name => 'Test', :field_format => 'foo')
+ assert !field.valid?
+ end
+
+ def test_field_format_validation_should_accept_formats_added_at_runtime
+ Redmine::CustomFieldFormat.register 'foobar'
+
+ field = CustomField.new(:name => 'Some Custom Field', :field_format => 'foobar')
+ assert field.valid?, 'field should be valid'
+ ensure
+ Redmine::CustomFieldFormat.delete 'foobar'
+ end
+
def test_should_not_change_field_format_of_existing_custom_field
field = CustomField.find(1)
field.field_format = 'int'