summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-08-11 00:31:18 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-08-11 00:31:18 +0000
commit163659d0a56e1bf28f4ffc18ee5d735db9a0df97 (patch)
tree76399d41aa4d13a0d47b5dfd603496b1a139bdc8 /test/unit
parentec02853141d628c21323631f8ff58ca644bafcb0 (diff)
downloadredmine-163659d0a56e1bf28f4ffc18ee5d735db9a0df97.tar.gz
redmine-163659d0a56e1bf28f4ffc18ee5d735db9a0df97.zip
cherry-pick avatar test from reverted r10184
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10194 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/helpers/application_helper_test.rb40
1 files changed, 21 insertions, 19 deletions
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
index b3757b092..1ef2ff0f7 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -970,25 +970,27 @@ RAW
end
end
- def test_avatar
- # turn on avatars
- Setting.gravatar_enabled = '1'
- 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'))
- # Default size is 50
- assert avatar('jsmith <jsmith@somenet.foo>').include?('size=50')
- assert avatar('jsmith <jsmith@somenet.foo>', :size => 24).include?('size=24')
- # Non-avatar options should be considered html options
- assert avatar('jsmith <jsmith@somenet.foo>', :title => 'John Smith').include?('title="John Smith"')
- # 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>', :class => 'picture').include?('class="gravatar"')
- assert_nil avatar('jsmith')
- assert_nil avatar(nil)
-
- # turn off avatars
- Setting.gravatar_enabled = '0'
- assert_equal '', avatar(User.find_by_mail('jsmith@somenet.foo'))
+ def test_avatar_enabled
+ with_settings :gravatar_enabled => '1' do
+ 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'))
+ # Default size is 50
+ assert avatar('jsmith <jsmith@somenet.foo>').include?('size=50')
+ assert avatar('jsmith <jsmith@somenet.foo>', :size => 24).include?('size=24')
+ # Non-avatar options should be considered html options
+ assert avatar('jsmith <jsmith@somenet.foo>', :title => 'John Smith').include?('title="John Smith"')
+ # 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>', :class => 'picture').include?('class="gravatar"')
+ assert_nil avatar('jsmith')
+ assert_nil avatar(nil)
+ end
+ end
+
+ def test_avatar_disabled
+ with_settings :gravatar_enabled => '0' do
+ assert_equal '', avatar(User.find_by_mail('jsmith@somenet.foo'))
+ end
end
def test_link_to_user