Commit 026c15b3 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'fix_no_method_error_in_unfold_presenter' into 'master'

Fix NoMethodError for UnfoldPresenter

See merge request gitlab-org/gitlab!79468
parents 80ed9b2d 2add7932
......@@ -108,7 +108,7 @@ module Blobs
def limit(lines)
return lines if full?
lines[since - 1..to - 1]
lines[since - 1..to - 1] || []
end
end
end
......@@ -206,6 +206,14 @@ RSpec.describe Blobs::UnfoldPresenter do
end
end
context 'when since exceeds number of lines' do
let(:params) { { since: 2 } }
it 'returns an empty list' do
expect(subject.lines.size).to eq(0)
end
end
context 'when full is true' do
let(:params) { { full: true } }
......
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