aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/public_body_category_spec.rb20
1 files changed, 20 insertions, 0 deletions
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