add unit test of CustomField model before_validation

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8190 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-12-11 12:04:16 +00:00
parent 0471de41ff
commit 4f8ed70813
1 changed files with 10 additions and 0 deletions

View File

@ -25,6 +25,16 @@ class CustomFieldTest < ActiveSupport::TestCase
assert field.save
end
def test_before_validation
field = CustomField.new(:name => 'test_before_validation', :field_format => 'int')
field.searchable = true
assert field.save
assert_equal false, field.searchable
field.searchable = true
assert field.save
assert_equal false, field.searchable
end
def test_regexp_validation
field = IssueCustomField.new(:name => 'regexp', :field_format => 'text', :regexp => '[a-z0-9')
assert !field.save