diff options
Diffstat (limited to 'test/helpers/application_helper_test.rb')
-rw-r--r-- | test/helpers/application_helper_test.rb | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 41ed07bc1..2804c3253 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -1495,87 +1495,6 @@ RAW assert_select_in result, 'ul.pages-hierarchy li ul.pages-hierarchy a[href=?]', "##{child_page.title}" end - def test_avatar_with_user - with_settings :gravatar_enabled => '1' do - assert_include Digest::MD5.hexdigest('jsmith@somenet.foo'), avatar(User.find_by_mail('jsmith@somenet.foo')) - end - end - - def test_avatar_with_email_string - with_settings :gravatar_enabled => '1' do - assert_include Digest::MD5.hexdigest('jsmith@somenet.foo'), avatar('jsmith <jsmith@somenet.foo>') - end - end - - def test_avatar_with_anonymous_user - with_settings :gravatar_enabled => '1' do - assert_match %r{src="/images/anonymous.png(\?\d+)?"}, avatar(User.anonymous) - end - end - - def test_avatar_with_group - with_settings :gravatar_enabled => '1' do - assert_nil avatar(Group.first) - end - end - - def test_avatar_with_invalid_arg_should_return_nil - with_settings :gravatar_enabled => '1' do - assert_nil avatar('jsmith') - assert_nil avatar(nil) - end - end - - def test_avatar_default_size_should_be_50 - with_settings :gravatar_enabled => '1' do - assert_include 'size=50', avatar('jsmith <jsmith@somenet.foo>') - end - end - - def test_avatar_with_size_option - with_settings :gravatar_enabled => '1' do - assert_include 'size=24', avatar('jsmith <jsmith@somenet.foo>', :size => 24) - assert_include 'width="24" height="24"', avatar(User.anonymous, :size => 24) - end - end - - def test_avatar_with_html_option - with_settings :gravatar_enabled => '1' do - # Non-avatar options should be considered html options - assert_include 'title="John Smith"', avatar('jsmith <jsmith@somenet.foo>', :title => 'John Smith') - end - end - - def test_avatar_css_class - with_settings :gravatar_enabled => '1' do - # The default class of the img tag should be gravatar - assert_include 'class="gravatar"', avatar('jsmith <jsmith@somenet.foo>') - assert_not_include 'class="gravatar"', avatar('jsmith <jsmith@somenet.foo>', :class => 'picture') - assert_include 'class="picture"', avatar('jsmith <jsmith@somenet.foo>', :class => 'picture') - 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_avatar_server_url - to_test = { - 'https://www.gravatar.com' => %r|https://www.gravatar.com/avatar/\h{32}|, - 'https://seccdn.libravatar.org' => %r|https://seccdn.libravatar.org/avatar/\h{32}|, - 'http://localhost:8080' => %r|http://localhost:8080/avatar/\h{32}|, - } - with_settings :gravatar_enabled => '1' do - to_test.each do |url, expected| - Redmine::Configuration.with 'avatar_server_url' => url do - assert_match expected, avatar('<jsmith@somenet.foo>') - end - end - end - end - def test_link_to_user user = User.find(2) result = link_to("John Smith", "/users/2", :class => "user active") |