diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
commit | 9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch) | |
tree | 865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/finders/tags_finder_spec.rb | |
parent | 6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff) |
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/finders/tags_finder_spec.rb')
-rw-r--r-- | spec/finders/tags_finder_spec.rb | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/spec/finders/tags_finder_spec.rb b/spec/finders/tags_finder_spec.rb index 525c19ba137..378acc67a50 100644 --- a/spec/finders/tags_finder_spec.rb +++ b/spec/finders/tags_finder_spec.rb @@ -2,11 +2,15 @@ require 'spec_helper' -RSpec.describe TagsFinder do +RSpec.describe TagsFinder, feature_category: :source_code_management do + subject(:tags_finder) { described_class.new(repository, params) } + let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, :repository) } let_it_be(:repository) { project.repository } + let(:params) { {} } + def load_tags(params, gitaly_pagination: false) described_class.new(repository, params).execute(gitaly_pagination: gitaly_pagination) end @@ -210,4 +214,58 @@ RSpec.describe TagsFinder do end end end + + describe '#next_cursor' do + subject { tags_finder.next_cursor } + + it 'always nil before #execute call' do + is_expected.to be_nil + end + + context 'after #execute' do + context 'with gitaly pagination' do + before do + tags_finder.execute(gitaly_pagination: true) + end + + context 'without pagination params' do + it { is_expected.to be_nil } + end + + context 'with pagination params' do + let(:params) { { per_page: 5 } } + + it { is_expected.to be_present } + + context 'when all objects can be returned on the same page' do + let(:params) { { per_page: 100 } } + + it { is_expected.to be_present } + end + end + end + + context 'without gitaly pagination' do + before do + tags_finder.execute(gitaly_pagination: false) + end + + context 'without pagination params' do + it { is_expected.to be_nil } + end + + context 'with pagination params' do + let(:params) { { per_page: 5 } } + + it { is_expected.to be_nil } + + context 'when all objects can be returned on the same page' do + let(:params) { { per_page: 100 } } + + it { is_expected.to be_nil } + end + end + end + end + end end |