From caceb58947a87ee59dddafb9fa0efff95a2200e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= Date: Sun, 10 Jun 2012 20:34:23 +0200 Subject: [PATCH] Restore the default class for gravatars #1034 --- app/helpers/application_helper.rb | 1 + test/unit/helpers/application_helper_test.rb | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 80a8a50d..2ecf9671 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -962,6 +962,7 @@ module ApplicationHelper [:default, :size, :rating, :filetype].each {|key| gravatarify_options[key] = options.delete key} # Default size is 50x50 px gravatarify_options[:size] ||= 50 + options[:class] ||= 'gravatar' gravatarify_options[:html] = options gravatar_tag email, gravatarify_options end diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 00985c3c..b964b85d 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -669,6 +669,9 @@ RAW assert avatar('jsmith ', :size => 24).include?('s=24') # Non-avatar options should be considered html options assert avatar('jsmith ', :title => 'John Smith').include?('title="John Smith"') + # The default class of the img tag should be gravatar + assert avatar('jsmith ').include?('class="gravatar"') + assert !avatar('jsmith ', :class => 'picture').include?('class="gravatar"') assert_nil avatar('jsmith') assert_nil avatar(nil)