diff options
Diffstat (limited to 'test/helpers/avatars_helper_test.rb')
-rw-r--r-- | test/helpers/avatars_helper_test.rb | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/test/helpers/avatars_helper_test.rb b/test/helpers/avatars_helper_test.rb index f407ae09e..6b426bc98 100644 --- a/test/helpers/avatars_helper_test.rb +++ b/test/helpers/avatars_helper_test.rb @@ -63,14 +63,26 @@ class AvatarsHelperTest < Redmine::HelperTest end def test_avatar_css_class - # The default class of the img tag should be gravatar - assert_include 'class="gravatar"', avatar('jsmith <jsmith@somenet.foo>') - assert_include 'class="gravatar picture"', avatar('jsmith <jsmith@somenet.foo>', :class => 'picture') + # The default classes of the img tag should be gravatar and avatar + assert_include 'class="gravatar avatar"', avatar('jsmith <jsmith@somenet.foo>') + assert_include 'class="gravatar avatar picture"', avatar('jsmith <jsmith@somenet.foo>', :class => 'picture') end - def test_avatar_disabled + def test_avatar_with_initials + with_settings :gravatar_default => 'initials' do + assert_include 'initials="RA"', avatar(User.find(1)) + end + end + + def test_avatar_should_reject_initials_if_default_is_not_initials + with_settings :gravatar_default => 'identicon' do + assert_not_include 'initials="RA"', avatar(User.find(1)) + end + end + + def test_avatar_disabled_should_display_user_initials with_settings :gravatar_enabled => '0' do - assert_equal '', avatar(User.find_by_mail('jsmith@somenet.foo')) + assert_equal "<span role=\"img\" class=\"avatar-color-2 avatar s24\">JS</span>", avatar(User.find_by_mail('jsmith@somenet.foo')) end end |