From b5f8f49dddabf4c263a19cb871ab3eb33b7b4d0c Mon Sep 17 00:00:00 2001 From: alda519 Date: Sat, 10 Sep 2011 17:31:34 +0200 Subject: [PATCH] default profile photo is no longer marked as set --- app/helpers/profiles_helper.rb | 6 +++++- spec/helpers/profiles_helper.rb | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/helpers/profiles_helper.rb b/app/helpers/profiles_helper.rb index 941c8058e..31c8a16d7 100644 --- a/app/helpers/profiles_helper.rb +++ b/app/helpers/profiles_helper.rb @@ -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 diff --git a/spec/helpers/profiles_helper.rb b/spec/helpers/profiles_helper.rb index 27f59ae3a..ce15f2613 100644 --- a/spec/helpers/profiles_helper.rb +++ b/spec/helpers/profiles_helper.rb @@ -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