Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8936f118
Commit
8936f118
authored
Dec 06, 2021
by
Pedro Pombeiro
Committed by
Vitali Tatarintev
Dec 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add NumbersHelper tests
parent
9aadeffd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
spec/helpers/numbers_helper_spec.rb
spec/helpers/numbers_helper_spec.rb
+31
-0
No files found.
spec/helpers/numbers_helper_spec.rb
0 → 100644
View file @
8936f118
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
NumbersHelper
do
describe
'#limited_counter_with_delimiter'
do
using
RSpec
::
Parameterized
::
TableSyntax
subject
{
limited_counter_with_delimiter
(
resource
,
**
options
)
}
where
(
:count
,
:options
,
:expected_result
)
do
# Using explicit limit
9
|
{
limit:
10
}
|
'9'
10
|
{
limit:
10
}
|
'10'
11
|
{
limit:
10
}
|
'10+'
12
|
{
limit:
10
}
|
'10+'
# Using default limit
999
|
{}
|
'999'
1000
|
{}
|
'1,000'
1001
|
{}
|
'1,000+'
1002
|
{}
|
'1,000+'
end
with_them
do
let
(
:page
)
{
double
(
'page'
,
total_count_with_limit:
[
count
,
options
.
fetch
(
:limit
,
1000
)
+
1
].
min
)
}
let
(
:resource
)
{
class_double
(
Ci
::
Runner
,
page:
page
)
}
it
{
is_expected
.
to
eq
(
expected_result
)
}
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment