diff options
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 |