@@ -970,25 +970,27 RAW | |||||
970 | end |
|
970 | end | |
971 | end |
|
971 | end | |
972 |
|
972 | |||
973 | def test_avatar |
|
973 | def test_avatar_enabled | |
974 | # turn on avatars |
|
974 | with_settings :gravatar_enabled => '1' do | |
975 | Setting.gravatar_enabled = '1' |
|
975 | assert avatar(User.find_by_mail('jsmith@somenet.foo')).include?(Digest::MD5.hexdigest('jsmith@somenet.foo')) | |
976 |
assert avatar( |
|
976 | assert avatar('jsmith <jsmith@somenet.foo>').include?(Digest::MD5.hexdigest('jsmith@somenet.foo')) | |
977 | assert avatar('jsmith <jsmith@somenet.foo>').include?(Digest::MD5.hexdigest('jsmith@somenet.foo')) |
|
977 | # Default size is 50 | |
978 | # Default size is 50 |
|
978 | assert avatar('jsmith <jsmith@somenet.foo>').include?('size=50') | |
979 |
assert avatar('jsmith <jsmith@somenet.foo>').include?('size= |
|
979 | assert avatar('jsmith <jsmith@somenet.foo>', :size => 24).include?('size=24') | |
980 | assert avatar('jsmith <jsmith@somenet.foo>', :size => 24).include?('size=24') |
|
980 | # Non-avatar options should be considered html options | |
981 | # Non-avatar options should be considered html options |
|
981 | assert avatar('jsmith <jsmith@somenet.foo>', :title => 'John Smith').include?('title="John Smith"') | |
982 | assert avatar('jsmith <jsmith@somenet.foo>', :title => 'John Smith').include?('title="John Smith"') |
|
982 | # The default class of the img tag should be gravatar | |
983 | # The default class of the img tag should be gravatar |
|
983 | assert avatar('jsmith <jsmith@somenet.foo>').include?('class="gravatar"') | |
984 | assert avatar('jsmith <jsmith@somenet.foo>').include?('class="gravatar"') |
|
984 | assert !avatar('jsmith <jsmith@somenet.foo>', :class => 'picture').include?('class="gravatar"') | |
985 | assert !avatar('jsmith <jsmith@somenet.foo>', :class => 'picture').include?('class="gravatar"') |
|
985 | assert_nil avatar('jsmith') | |
986 |
assert_nil avatar( |
|
986 | assert_nil avatar(nil) | |
987 | assert_nil avatar(nil) |
|
987 | end | |
988 |
|
988 | end | ||
989 | # turn off avatars |
|
989 | ||
990 | Setting.gravatar_enabled = '0' |
|
990 | def test_avatar_disabled | |
991 | assert_equal '', avatar(User.find_by_mail('jsmith@somenet.foo')) |
|
991 | with_settings :gravatar_enabled => '0' do | |
|
992 | assert_equal '', avatar(User.find_by_mail('jsmith@somenet.foo')) | |||
|
993 | end | |||
992 | end |
|
994 | end | |
993 |
|
995 | |||
994 | def test_link_to_user |
|
996 | def test_link_to_user |
General Comments 0
You need to be logged in to leave comments.
Login now