profile spec passes

This commit is contained in:
zhitomirskiyi 2011-01-17 18:22:54 -08:00
parent 8818a9bb6f
commit 8d86585928

View file

@ -56,17 +56,29 @@ class Profile < ActiveRecord::Base
def image_url= url
return image_url if url == ''
super(url)
if url.nil? || url.match(/^https?:\/\//)
super(url)
else
super(absolutify_local_url(url))
end
end
def image_url_small= url
return image_url if url == ''
super(url)
if url.nil? || url.match(/^https?:\/\//)
super(url)
else
super(absolutify_local_url(url))
end
end
def image_url_medium= url
return image_url if url == ''
super(url)
if url.nil? || url.match(/^https?:\/\//)
super(url)
else
super(absolutify_local_url(url))
end
end
def date= params
@ -86,4 +98,10 @@ class Profile < ActiveRecord::Base
self.last_name.strip! if self.last_name
end
private
def absolutify_local_url url
pod_url = AppConfig[:pod_url].dup
pod_url.chop! if AppConfig[:pod_url][-1,1] == '/'
"#{pod_url}#{url}"
end
end