diff options
-rw-r--r-- | app/models/public_body_category.rb | 1 | ||||
-rw-r--r-- | spec/models/public_body_category_spec.rb | 20 |
2 files changed, 20 insertions, 1 deletions
diff --git a/app/models/public_body_category.rb b/app/models/public_body_category.rb index 9e6783a05..e594d08e7 100644 --- a/app/models/public_body_category.rb +++ b/app/models/public_body_category.rb @@ -22,7 +22,6 @@ class PublicBodyCategory < ActiveRecord::Base validates_uniqueness_of :category_tag, :message => N_('Tag is already taken') validates_presence_of :title, :message => N_("Title can't be blank") validates_presence_of :category_tag, :message => N_("Tag can't be blank") - validates_presence_of :description, :message => N_("Description can't be blank") def self.get # migrate from file-based public body categories diff --git a/spec/models/public_body_category_spec.rb b/spec/models/public_body_category_spec.rb index 3f6fbe5ec..f27c4838b 100644 --- a/spec/models/public_body_category_spec.rb +++ b/spec/models/public_body_category_spec.rb @@ -52,4 +52,24 @@ describe PublicBodyCategory do end end + + context 'when validating' do + + it 'should require a title' do + category = PublicBodyCategory.new + category.should_not be_valid + category.errors[:title].should == ["Title can't be blank"] + end + + it 'should require a category tag' do + category = PublicBodyCategory.new + category.should_not be_valid + category.errors[:category_tag].should == ["Tag can't be blank"] + end + + it 'should require a unique tag' do + existing = FactoryGirl.create(:public_body_category) + PublicBodyCategory.new(:email => existing.category_tag).should_not be_valid + end + end end |