aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/public_body_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index efd170013..c443f0d6a 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -205,6 +205,12 @@ describe PublicBody, " when saving" do
pb.first_letter.should == 'Å'
end
+ it "should not save if the url_name is already taken" do
+ existing = FactoryGirl.create(:public_body)
+ pb = PublicBody.new(existing.attributes)
+ pb.should have(1).errors_on(:url_name)
+ end
+
it "should save the name when renaming an existing public body" do
public_body = public_bodies(:geraldine_public_body)
public_body.name = "Mark's Public Body"