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
d649c2b9
Commit
d649c2b9
authored
Jun 09, 2021
by
Gary Holtz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quick spec typos and fixes
parent
19484c77
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
8 deletions
+4
-8
lib/gitlab/highlight.rb
lib/gitlab/highlight.rb
+1
-3
spec/lib/gitlab/highlight_spec.rb
spec/lib/gitlab/highlight_spec.rb
+3
-5
No files found.
lib/gitlab/highlight.rb
View file @
d649c2b9
...
...
@@ -36,8 +36,6 @@ module Gitlab
plain
||=
self
.
class
.
too_large?
(
text
.
length
)
highlight_timeout
.
increment
(
source:
Gitlab
::
Runtime
.
sidekiq?
?
"background"
:
"foreground"
)
highlighted_text
=
highlight_text
(
text
,
continue:
continue
,
plain:
plain
)
highlighted_text
=
link_dependencies
(
text
,
highlighted_text
)
if
blob_name
highlighted_text
...
...
@@ -107,7 +105,7 @@ module Gitlab
end
def
highlighting_attempt
@highlight_
timeou
t
||=
Gitlab
::
Metrics
.
counter
(
@highlight_
attemp
t
||=
Gitlab
::
Metrics
.
counter
(
:file_highlighting_attempt
,
'Counts the times highlighting has been attempted on a file'
)
...
...
spec/lib/gitlab/highlight_spec.rb
View file @
d649c2b9
...
...
@@ -143,17 +143,15 @@ RSpec.describe Gitlab::Highlight do
end
describe
'highlight timeouts'
do
context
'when there is an attempt'
do
let
(
:result
)
{
described_class
.
highlight
(
file_name
,
content
)
}
let
(
:result
)
{
described_class
.
highlight
(
file_name
,
content
)
}
it
"increments the foreground counter if it's in the foreground"
do
context
'when there is an attempt'
do
it
"increments the attempt counter"
do
expect
{
result
}.
to
change
{
highlight_attempt_total
(
"undefined"
)
}
end
end
context
'when there is a timeout error while highlighting'
do
let
(
:result
)
{
described_class
.
highlight
(
file_name
,
content
)
}
before
do
allow
(
Timeout
).
to
receive
(
:timeout
).
twice
.
and_raise
(
Timeout
::
Error
)
# This is done twice because it's rescued first and then
...
...
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