default profile photo is no longer marked as set

This commit is contained in:
alda519 2011-09-10 17:31:34 +02:00
parent 4ab112645f
commit b5f8f49ddd
2 changed files with 14 additions and 1 deletions

View file

@ -29,6 +29,10 @@ module ProfilesHelper
# @param [Profile, Symbol] Profile and field in question
# @return [Boolean] The field in question is set?
def field_filled_out?(profile, field)
profile.send("#{field}".to_sym).present?
if field != :image_url
profile.send("#{field}".to_sym).present?
else
profile.send("#{field}".to_sym) != "/images/user/default.png"
end
end
end

View file

@ -17,6 +17,15 @@ describe ProfilesHelper do
@profile.bio = "abc"
field_filled_out?(@profile, :bio).should be_true
end
it 'returns false if default profile photo is used' do
field_filled_out?(@profile, :image_url).should be_false
end
it 'returns true if custom profile photo is set' do
@profile.image_url = "abc.jpg"
field_filled_out?(@profile, :image_url).should be_true
end
end
describe '#profile_field_tag' do