Merge pull request #1940 from alda519/profiles_helper-image
default profile photo is no longer marked as set
This commit is contained in:
commit
95aad7f15d
2 changed files with 14 additions and 1 deletions
|
|
@ -29,6 +29,10 @@ module ProfilesHelper
|
||||||
# @param [Profile, Symbol] Profile and field in question
|
# @param [Profile, Symbol] Profile and field in question
|
||||||
# @return [Boolean] The field in question is set?
|
# @return [Boolean] The field in question is set?
|
||||||
def field_filled_out?(profile, field)
|
def field_filled_out?(profile, field)
|
||||||
|
if field != :image_url
|
||||||
profile.send("#{field}".to_sym).present?
|
profile.send("#{field}".to_sym).present?
|
||||||
|
else
|
||||||
|
profile.send("#{field}".to_sym) != "/images/user/default.png"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,15 @@ describe ProfilesHelper do
|
||||||
@profile.bio = "abc"
|
@profile.bio = "abc"
|
||||||
field_filled_out?(@profile, :bio).should be_true
|
field_filled_out?(@profile, :bio).should be_true
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe '#profile_field_tag' do
|
describe '#profile_field_tag' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue