@@ -1134,7 +1134,7 module ApplicationHelper | |||
|
1134 | 1134 | # +user+ can be a User or a string that will be scanned for an email address (eg. 'joe <joe@foo.bar>') |
|
1135 | 1135 | def avatar(user, options = { }) |
|
1136 | 1136 | if Setting.gravatar_enabled? |
|
1137 |
options.merge!({:ssl => ( |
|
|
1137 | options.merge!({:ssl => (request && request.ssl?), :default => Setting.gravatar_default}) | |
|
1138 | 1138 | email = nil |
|
1139 | 1139 | if user.respond_to?(:mail) |
|
1140 | 1140 | email = user.mail |
@@ -970,8 +970,9 RAW | |||
|
970 | 970 | end |
|
971 | 971 | end |
|
972 | 972 | |
|
973 |
def test_avatar |
|
|
974 | with_settings :gravatar_enabled => '1' do | |
|
973 | def test_avatar | |
|
974 | # turn on avatars | |
|
975 | Setting.gravatar_enabled = '1' | |
|
975 | 976 |
|
|
976 | 977 |
|
|
977 | 978 |
|
@@ -984,24 +985,11 RAW | |||
|
984 | 985 |
|
|
985 | 986 |
|
|
986 | 987 |
|
|
987 | end | |
|
988 | end | |
|
989 | ||
|
990 | def test_avatar_should_use_ssl_if_protocol_is_https | |
|
991 | with_settings :gravatar_enabled => '1', :protocol => 'https' do | |
|
992 | assert_include 'https://', avatar(User.find_by_mail('jsmith@somenet.foo')) | |
|
993 | end | |
|
994 | 988 | |
|
995 | with_settings :gravatar_enabled => '1', :protocol => 'http' do | |
|
996 | assert_include 'http://', avatar(User.find_by_mail('jsmith@somenet.foo')) | |
|
997 | end | |
|
998 | end | |
|
999 | ||
|
1000 | def test_avatar_disabled | |
|
1001 | with_settings :gravatar_enabled => '0' do | |
|
989 | # turn off avatars | |
|
990 | Setting.gravatar_enabled = '0' | |
|
1002 | 991 |
|
|
1003 | 992 |
|
|
1004 | end | |
|
1005 | 993 | |
|
1006 | 994 | def test_link_to_user |
|
1007 | 995 | user = User.find(2) |
General Comments 0
You need to be logged in to leave comments.
Login now