-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support to disable the project size feature
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# helper for project pages. | ||
module ProjectsHelper | ||
|
||
def project_size_enabled | ||
project_timeout = Configuration.project_size_timeout.to_s | ||
!project_timeout.blank? && project_timeout != '0' | ||
end | ||
end |
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,22 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'test_helper' | ||
|
||
class ProjectsHelperTest < ActionView::TestCase | ||
include ProjectsHelper | ||
|
||
test 'project_size_enabled should be true when Configuration.project_size_timeout is different than 0' do | ||
Configuration.stubs(:project_size_timeout).returns('10') | ||
assert_equal true, project_size_enabled | ||
end | ||
|
||
test 'project_size_enabled should be false when Configuration.project_size_timeout is 0' do | ||
Configuration.stubs(:project_size_timeout).returns('0') | ||
assert_equal false, project_size_enabled | ||
end | ||
|
||
test 'project_size_enabled should handle nil' do | ||
Configuration.stubs(:project_size_timeout).returns(nil) | ||
assert_equal false, project_size_enabled | ||
end | ||
end |