diff options
Diffstat (limited to 'spec/lib/gitlab/tree_summary_spec.rb')
-rw-r--r-- | spec/lib/gitlab/tree_summary_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/lib/gitlab/tree_summary_spec.rb b/spec/lib/gitlab/tree_summary_spec.rb index f45005fcc9b..42cc15a9033 100644 --- a/spec/lib/gitlab/tree_summary_spec.rb +++ b/spec/lib/gitlab/tree_summary_spec.rb @@ -25,6 +25,14 @@ RSpec.describe Gitlab::TreeSummary do it 'defaults limit to 25' do expect(summary.limit).to eq(25) end + + context 'when offset is larger than the maximum' do + let(:offset) { described_class::MAX_OFFSET + 1 } + + it 'sets offset to the maximum' do + expect(subject.offset).to eq(described_class::MAX_OFFSET) + end + end end describe '#summarize' do @@ -45,6 +53,14 @@ RSpec.describe Gitlab::TreeSummary do end end + context 'when offset is negative' do + let(:offset) { -1 } + + it 'returns an empty array' do + expect(entries).to eq([]) + end + end + context 'with caching', :use_clean_rails_memory_store_caching do subject { Rails.cache.fetch(key) } |