-
Notifications
You must be signed in to change notification settings - Fork 923
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4201 from AntonKhorev/issues-limit-settings
Move max value of issues counter to settings
- Loading branch information
Showing
5 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require "test_helper" | ||
|
||
class IssuesHelperTest < ActionView::TestCase | ||
attr_accessor :current_user | ||
|
||
def test_issues_count | ||
target_user = create(:user) | ||
self.current_user = create(:moderator_user) | ||
|
||
n = (Settings.max_issues_count - 1) | ||
n.times do | ||
create(:note_with_comments) do |note| | ||
create(:issue, :reportable => note, :reported_user => target_user, :assigned_role => "moderator") | ||
end | ||
end | ||
expected = <<~HTML.delete("\n") | ||
<span class="badge count-number">#{n}</span> | ||
HTML | ||
assert_dom_equal expected, open_issues_count | ||
|
||
n += 1 | ||
create(:note_with_comments) do |note| | ||
create(:issue, :reportable => note, :reported_user => target_user, :assigned_role => "moderator") | ||
end | ||
expected = <<~HTML.delete("\n") | ||
<span class="badge count-number">#{n}+</span> | ||
HTML | ||
assert_dom_equal expected, open_issues_count | ||
end | ||
end |