diff options
-rw-r--r-- | app/helpers/application_helper.rb | 8 | ||||
-rw-r--r-- | spec/helpers/application_helper_spec.rb | 28 |
2 files changed, 0 insertions, 36 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 77c86be4714..a889decab26 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -68,14 +68,6 @@ module ApplicationHelper end end - def avatar_icon(user_or_email = nil, size = nil, scale = 2, only_path: true) - if user_or_email.is_a?(User) - avatar_icon_for_user(user_or_email, size, scale, only_path: only_path) - else - avatar_icon_for_email(user_or_email, size, scale, only_path: only_path) - end - end - def avatar_icon_for_email(email = nil, size = nil, scale = 2, only_path: true) user = User.find_by_any_email(email.try(:downcase)) if user diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index a1fcdeca10e..96bd4c96ae4 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -63,34 +63,6 @@ describe ApplicationHelper do end end - describe 'avatar_icon' do - let(:user) { create(:user, avatar: File.open(uploaded_image_temp_path)) } - - context 'using an email' do - context 'when there is a matching user' do - it 'returns a relative URL for the avatar' do - expect(helper.avatar_icon(user.email).to_s) - .to eq(user.avatar.url) - end - end - - context 'when no user exists for the email' do - it 'calls gravatar_icon' do - expect(helper).to receive(:gravatar_icon).with('foo@example.com', 20, 2) - - helper.avatar_icon('foo@example.com', 20, 2) - end - end - end - - describe 'using a user' do - it 'returns a relative URL for the avatar' do - expect(helper.avatar_icon(user).to_s) - .to eq(user.avatar.url) - end - end - end - describe 'avatar_icon_for_email' do let(:user) { create(:user, avatar: File.open(uploaded_image_temp_path)) } |