]> git.openstreetmap.org Git - rails.git/blob - test/helpers/issues_helper_test.rb
Merge remote-tracking branch 'upstream/pull/5143'
[rails.git] / test / helpers / issues_helper_test.rb
1 require "test_helper"
2
3 class IssuesHelperTest < ActionView::TestCase
4   attr_accessor :current_user
5
6   def test_issues_count
7     target_user = create(:user)
8     self.current_user = create(:moderator_user)
9
10     n = (Settings.max_issues_count - 1)
11     n.times do
12       create(:note_with_comments) do |note|
13         create(:issue, :reportable => note, :reported_user => target_user, :assigned_role => "moderator")
14       end
15     end
16     expected = <<~HTML.delete("\n")
17       <span class="badge count-number">#{n}</span>
18     HTML
19     assert_dom_equal expected, open_issues_count
20
21     n += 1
22     create(:note_with_comments) do |note|
23       create(:issue, :reportable => note, :reported_user => target_user, :assigned_role => "moderator")
24     end
25     expected = <<~HTML.delete("\n")
26       <span class="badge count-number">#{n}+</span>
27     HTML
28     assert_dom_equal expected, open_issues_count
29   end
30 end