Commit d649c2b9 authored by Gary Holtz's avatar Gary Holtz

Quick spec typos and fixes

parent 19484c77
......@@ -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_timeout ||= Gitlab::Metrics.counter(
@highlight_attempt ||= Gitlab::Metrics.counter(
:file_highlighting_attempt,
'Counts the times highlighting has been attempted on a file'
)
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment