Project

General

Profile

Defect #42192 ยป 42192.patch

Go MAEDA, 2025-01-30 10:33

View differences:

app/helpers/icons_helper.rb
46 46
  end
47 47

  
48 48
  def principal_icon(principal, **options)
49
    return if principal.nil?
49 50
    raise ArgumentError, "First argument has to be a Principal, was #{principal.inspect}" unless principal.is_a?(Principal)
50 51

  
51 52
    principal_class = principal.class.name.downcase
test/helpers/icons_helper_test.rb
107 107
    assert_nil principal_icon(Principal.find(1))
108 108
  end
109 109

  
110
  def test_principal_icon_should_not_raise_exception_for_nil
111
    assert_nil principal_icon(nil)
112
  end
113

  
110 114
  def test_activity_event_type_icon_should_return_correct_icon_for_reply_events
111 115
    expected = %r{<svg class="s18 icon-svg" aria-hidden="true"><use href="/assets/icons-\w+.svg#icon--comments"></use></svg>}
112 116
    assert_match expected, activity_event_type_icon('reply')
    (1-1/1)