Merge pull request #1940 from alda519/profiles_helper-image

default profile photo is no longer marked as set
This commit is contained in:
Daniel Grippi 2011-09-10 19:25:47 -07:00
commit 95aad7f15d
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