Project

General

Profile

Feature #32976 » disp-avatar-on-watcher-dialog-test.patch

Takenori TAKAKI, 2020-03-17 07:20

View differences:

test/helpers/application_helper_test.rb
22 22
class ApplicationHelperTest < Redmine::HelperTest
23 23
  include ERB::Util
24 24
  include Rails.application.routes.url_helpers
25
  include AvatarsHelper
25 26

  
26 27
  fixtures :projects, :enabled_modules,
27 28
           :users, :email_addresses,
......
1704 1705
    end
1705 1706
  end
1706 1707

  
1708
  def test_principals_check_box_tag_with_avatar
1709
    principals = [User.find(1), Group.find(10)]
1710
    with_settings :gravatar_enabled => '1' do
1711
      tags = principals_check_box_tags("watcher[user_ids][]", principals)
1712
      principals.each do |principal|
1713
        assert_include avatar(principal, :size => 16), tags
1714
        assert_not_include content_tag('span', nil, :class => "name icon icon-#{principal.class.name.downcase}"), tags
1715
      end
1716
    end
1717
  end
1718

  
1719
  def test_principals_check_box_tag_without_avatar
1720
    principals = [User.find(1), Group.find(10)]
1721
    Setting.gravatar_enabled = '1'
1722
    avatar_tags = principals.collect{|p| avatar(p, :size => 16) }
1723

  
1724
    with_settings :gravatar_enabled => '0' do
1725
      tags = principals_check_box_tags(name, principals)
1726
      principals.each_with_index do |principal, i|
1727
        assert_not_include avatar_tags[i], tags
1728
        assert_include content_tag('span', nil, :class => "name icon icon-#{principal.class.name.downcase}"), tags
1729
      end
1730
    end
1731
  end
1732

  
1707 1733
  def test_principals_options_for_select_with_users
1708 1734
    User.current = nil
1709 1735
    users = [User.find(2), User.find(4)]
test/helpers/groups_helper_test.rb
22 22
class GroupsHelperTest < Redmine::HelperTest
23 23
  include ERB::Util
24 24
  include GroupsHelper
25
  include AvatarsHelper
25 26
  include Rails.application.routes.url_helpers
26 27

  
27 28
  fixtures :users
test/helpers/members_helper_test.rb
22 22
class MembersHelperTest < Redmine::HelperTest
23 23
  include ERB::Util
24 24
  include MembersHelper
25
  include AvatarsHelper
25 26
  include Rails.application.routes.url_helpers
26 27

  
27 28
  fixtures :projects, :users, :members, :member_roles,
(3-3/3)