Limit revision's description text length
This commit is contained in:
parent
5b85416d79
commit
d5448267be
@ -55,6 +55,7 @@ class DmsfFileRevision < ActiveRecord::Base
|
|||||||
validates :title, :presence => true
|
validates :title, :presence => true
|
||||||
validates_format_of :name, :with => DmsfFolder::INVALID_CHARACTERS,
|
validates_format_of :name, :with => DmsfFolder::INVALID_CHARACTERS,
|
||||||
:message => l(:error_contains_invalid_character)
|
:message => l(:error_contains_invalid_character)
|
||||||
|
validates :description, length: { maximum: 1.megabyte }
|
||||||
|
|
||||||
def project
|
def project
|
||||||
self.dmsf_file.project if self.dmsf_file
|
self.dmsf_file.project if self.dmsf_file
|
||||||
|
|||||||
@ -210,4 +210,11 @@ class DmsfFileRevisionTest < RedmineDmsf::Test::UnitTest
|
|||||||
assert_equal -(' '.ord), @revision1.minor_version
|
assert_equal -(' '.ord), @revision1.minor_version
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def description_max_length
|
||||||
|
@revision1.description = 2.megabytes * 'a'
|
||||||
|
assert !@revision1.save
|
||||||
|
@revision1.description = 1.megabyte * 'a'
|
||||||
|
assert @revision1.save
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user