--- src/app/models/template.rb | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/app/models/template.rb b/src/app/models/template.rb index 9264e76..e9f2327 100644 --- a/src/app/models/template.rb +++ b/src/app/models/template.rb @@ -14,6 +14,7 @@ class Template < ActiveRecord::Base # unset) validates_presence_of :name validates_uniqueness_of :name + validates_length_of :name, :maximum => 255 validates_presence_of :platform validates_presence_of :platform_version validates_presence_of :architecture
--- src/spec/models/template_spec.rb | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/spec/models/template_spec.rb b/src/spec/models/template_spec.rb index ef30fc1..2b8f7ea 100644 --- a/src/spec/models/template_spec.rb +++ b/src/spec/models/template_spec.rb @@ -16,4 +16,12 @@ describe Template do rimg.save tpl.providers.size.should eql(1) end + + it "should not be valid if template name is too long" do + t = Factory.build(:template) + t.xml.name = ('a' * 256) + t.valid?.should be_false + t.errors[:name].should_not be_nil + t.errors[:name].should =~ /^is too long.*/ + end end
On 11/04/2010 09:48 PM, Mohammed Morsi wrote:
src/spec/models/template_spec.rb | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/spec/models/template_spec.rb b/src/spec/models/template_spec.rb index ef30fc1..2b8f7ea 100644 --- a/src/spec/models/template_spec.rb +++ b/src/spec/models/template_spec.rb @@ -16,4 +16,12 @@ describe Template do rimg.save tpl.providers.size.should eql(1) end
- it "should not be valid if template name is too long" do
- t = Factory.build(:template)
- t.xml.name = ('a' * 256)
- t.valid?.should be_false
- t.errors[:name].should_not be_nil
- t.errors[:name].should =~ /^is too long.*/
- end end
ACK (both)
deltacloud-devel@lists.fedorahosted.org