https is now a valid url for people. thx grippi

This commit is contained in:
maxwell 2010-10-29 12:30:38 -07:00
parent 9c2ca15e93
commit a7b3fc48ec
2 changed files with 10 additions and 2 deletions

View file

@ -148,10 +148,11 @@ class Person
end end
protected protected
def clean_url def clean_url
self.url ||= "http://localhost:3000/" if self.class == User self.url ||= "http://localhost:3000/" if self.class == User
if self.url if self.url
self.url = 'http://' + self.url unless self.url.match('http://' || 'https://') self.url = 'http://' + self.url unless self.url.match(/https?:\/\//)
self.url = self.url + '/' if self.url[-1, 1] != '/' self.url = self.url + '/' if self.url[-1, 1] != '/'
end end
end end
@ -160,5 +161,4 @@ class Person
def remove_all_traces def remove_all_traces
Post.all(:person_id => id).each { |p| p.delete } Post.all(:person_id => id).each { |p| p.delete }
end end
end end

View file

@ -13,6 +13,14 @@ describe Person do
@aspect2 = @user2.aspect(:name => "Abscence of Babes") @aspect2 = @user2.aspect(:name => "Abscence of Babes")
end end
describe "vaild url" do
it 'should allow for https urls' do
person = Factory.create(:person, :url => "https://example.com")
person.valid?.should == true
end
end
describe '#diaspora_handle' do describe '#diaspora_handle' do
context 'local people' do context 'local people' do
it 'uses the pod config url to set the diaspora_handle' do it 'uses the pod config url to set the diaspora_handle' do