From 2ad74d397ce3a8fd29e24abe1f120541816bbf9d Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 13 Nov 2010 19:05:12 -0800 Subject: [PATCH] fix build --- app/models/person.rb | 1 + spec/models/person_spec.rb | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/person.rb b/app/models/person.rb index 19eef2969..b7025a25e 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -37,6 +37,7 @@ class Person before_destroy :remove_all_traces before_validation :clean_url validates_presence_of :url, :profile, :serialized_public_key + validates_uniqueness_of :diaspora_handle, :case_sensitive => false #validates_format_of :url, :with => # /^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb index 8d43e1def..d7aa61fb9 100644 --- a/spec/models/person_spec.rb +++ b/spec/models/person_spec.rb @@ -29,7 +29,7 @@ describe Person do describe "vaild url" do it 'should allow for https urls' do person = Factory.create(:person, :url => "https://example.com") - person.valid?.should == true + person.should be_valid end end @@ -51,12 +51,12 @@ describe Person do describe 'validation' do it 'is unique' do person_two = Factory.build(:person, :diaspora_handle => @person.diaspora_handle) - person_two.valid?.should be_false + person_two.should_not be_valid end it 'is case insensitive' do - person_two = Factory.build(:person, :url => @person.url.upcase) - person_two.valid?.should be_false + person_two = Factory.build(:person, :diaspora_handle => @person.diaspora_handle.upcase) + person_two.should_not be_valid end end end