cherry-pick avatar test from reverted r10184
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10194 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
ec02853141
commit
163659d0a5
|
@ -970,25 +970,27 @@ RAW
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_avatar
|
def test_avatar_enabled
|
||||||
# turn on avatars
|
with_settings :gravatar_enabled => '1' do
|
||||||
Setting.gravatar_enabled = '1'
|
assert avatar(User.find_by_mail('jsmith@somenet.foo')).include?(Digest::MD5.hexdigest('jsmith@somenet.foo'))
|
||||||
assert avatar(User.find_by_mail('jsmith@somenet.foo')).include?(Digest::MD5.hexdigest('jsmith@somenet.foo'))
|
assert avatar('jsmith <jsmith@somenet.foo>').include?(Digest::MD5.hexdigest('jsmith@somenet.foo'))
|
||||||
assert avatar('jsmith <jsmith@somenet.foo>').include?(Digest::MD5.hexdigest('jsmith@somenet.foo'))
|
# Default size is 50
|
||||||
# Default size is 50
|
assert avatar('jsmith <jsmith@somenet.foo>').include?('size=50')
|
||||||
assert avatar('jsmith <jsmith@somenet.foo>').include?('size=50')
|
assert avatar('jsmith <jsmith@somenet.foo>', :size => 24).include?('size=24')
|
||||||
assert avatar('jsmith <jsmith@somenet.foo>', :size => 24).include?('size=24')
|
# Non-avatar options should be considered html options
|
||||||
# Non-avatar options should be considered html options
|
assert avatar('jsmith <jsmith@somenet.foo>', :title => 'John Smith').include?('title="John Smith"')
|
||||||
assert avatar('jsmith <jsmith@somenet.foo>', :title => 'John Smith').include?('title="John Smith"')
|
# The default class of the img tag should be gravatar
|
||||||
# The default class of the img tag should be gravatar
|
assert avatar('jsmith <jsmith@somenet.foo>').include?('class="gravatar"')
|
||||||
assert avatar('jsmith <jsmith@somenet.foo>').include?('class="gravatar"')
|
assert !avatar('jsmith <jsmith@somenet.foo>', :class => 'picture').include?('class="gravatar"')
|
||||||
assert !avatar('jsmith <jsmith@somenet.foo>', :class => 'picture').include?('class="gravatar"')
|
assert_nil avatar('jsmith')
|
||||||
assert_nil avatar('jsmith')
|
assert_nil avatar(nil)
|
||||||
assert_nil avatar(nil)
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# turn off avatars
|
def test_avatar_disabled
|
||||||
Setting.gravatar_enabled = '0'
|
with_settings :gravatar_enabled => '0' do
|
||||||
assert_equal '', avatar(User.find_by_mail('jsmith@somenet.foo'))
|
assert_equal '', avatar(User.find_by_mail('jsmith@somenet.foo'))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_link_to_user
|
def test_link_to_user
|
||||||
|
|
Loading…
Reference in New Issue